Other count digits recursive

For me, 'log' usually means a base 10, and 'ln' - base e. For anything else, the base is specified as a subscript. I remember some people from my CS classes played with specifying the base in hex during a 'recitation session'.
 
Allow me to come back to infinite fibonacci sequences.
Next program is rather fast, i think it might have "memoization".
Code:
import java.util.function.UnaryOperator;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class test3 {
    public static void main(String[] args) {
        int beginvalue[] = new int[] { 0, 1 };
        UnaryOperator<int[]> fibo_seq = a -> new int[] { a[1], a[0] + a[1] };
        Stream<int[]> s = Stream.iterate(beginvalue, fibo_seq);
        IntStream fibStream = s.mapToInt(a -> a[1]);
        IntStream limitedstream = fibStream.limit(42);
        limitedstream.forEach(System.out::println);
    }
}
Based on,
 
Back
Top