Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Sylvesters-sequence/F-Sharp/sylvesters-sequence.fs
Normal file
4
Task/Sylvesters-sequence/F-Sharp/sylvesters-sequence.fs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Sylvester's sequence: Nigel Galloway. June 7th., 2021
|
||||
let S10=Seq.unfold(fun(n,g)->printfn "*%A %A" n g; Some(n,(n*g+1I,n*g) ) )(2I,1I)|>Seq.take 10|>List.ofSeq
|
||||
S10|>List.iteri(fun n g->printfn "%2d -> %A" (n+1) g)
|
||||
let n,g=S10|>List.fold(fun(n,g) i->(n*i+g,g*i))(0I,1I) in printfn "\nThe sum of the reciprocals of S10 is \n%A/\n%A" n g
|
||||
Loading…
Add table
Add a link
Reference in a new issue