Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
9
Task/M-bius-function/F-Sharp/m-bius-function.fs
Normal file
9
Task/M-bius-function/F-Sharp/m-bius-function.fs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Möbius function. Nigel Galloway: January 31st., 2021
|
||||
let fN g=let n=primes32()
|
||||
let rec fN i g e l=match (l/g,l%g,e) with (1,0,false)->i
|
||||
|(n,0,false)->fN (0-i) g true n
|
||||
|(_,0,true) ->0
|
||||
|_ ->fN i (Seq.head n) false l
|
||||
fN -1 (Seq.head n) false g
|
||||
let mobius=seq{yield 1; yield! Seq.initInfinite((+)2>>fN)}
|
||||
mobius|>Seq.take 500|>Seq.chunkBySize 25|>Seq.iter(fun n->Array.iter(printf "%3d") n;printfn "")
|
||||
Loading…
Add table
Add a link
Reference in a new issue