Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Lazy and infinite sequences / Exercises
Powers of three
Problem
Using the sequence operator with a closure rule, build the infinite
series of powers of three (1, 3, 9, 27, … — each term three
times the last) and print the first five of them.
Example
The program prints:
(1 3 9 27 81)Solution
Course navigation
← Solution: The first multiples of seven | Solution: Powers of three →