RosettaCodeData/Task/Thue-Morse/F-Sharp/thue-morse.fs
2024-04-19 16:56:29 -07:00

4 lines
221 B
FSharp

// Thue-Morse. Nigel Galloway: April 16th., 2024
let rec fG n g=match n with 0->g |1->g+1 |n ->fG(n/2)(g+n&&&1)
let thueMorse=Seq.initInfinite(fun n->(fG n 0)%2)
thueMorse|>Seq.take 25|>Seq.iter(printf "%d "); printfn ""