Starting with a variable x=1, Print the sequence
"1,2,4,8,16,32,64,128," by doubling x and checking that x is less than 150.
clojure (take-while #(< % 150) (iterate #(* 2 %) 1))
(take-while #(< % 150) (iterate #(* 2 %) 1))
Submit a new solution for
clojure
There are 19 other solutions in
additional languages (
cpp,
csharp,
erlang,
fantom ...)