/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /** * * f(n) = f1(n) ^ i */ //-------------------- public class Power extends Sequence { private long power; private Sequence s; public Power(Sequence s, long power) { this.s = s; this.power = power; } public long next() { long res = 1; long n = s.next(); for (long i = 0; i < power; ++i) { res *= n; } return res; } } //--------------------