Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-1.fs
Normal file
5
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-1.fs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// Cyclop numbers. Nigel Galloway: June 25th., 2021
|
||||
let rec fG n g=seq{yield! g|>Seq.collect(fun i->g|>Seq.map(fun g->n*i+g)); yield! fG(n*10)(fN g)}
|
||||
let cyclops=seq{yield 0; yield! fG 100 [1..9]}
|
||||
let primeCyclops,blindCyclops=cyclops|>Seq.filter isPrime,Seq.zip(fG 100 [1..9])(fG 10 [1..9])|>Seq.filter(fun(n,g)->isPrime n && isPrime g)|>Seq.map fst
|
||||
let palindromicCyclops=let fN g=let rec fN g=[yield g%10; if g>9 then yield! fN(g/10)] in let n=fN g in n=List.rev n in primeCyclops|>Seq.filter fN
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-2.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-2.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
cyclops|>Seq.take 50|>Seq.iter(printf "%d "); printfn ""
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-3.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-3.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
primeCyclops|>Seq.take 50|>Seq.iter(printf "%d "); printfn ""
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-4.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-4.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
blindCyclops|>Seq.take 50|>Seq.iter(printf "%d "); printfn ""
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-5.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-5.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
palindromicCyclops|>Seq.take 50|>Seq.iter(printf "%d "); printfn ""
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-6.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-6.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
let n=cyclops|>Seq.findIndex(fun n->n>10000000) in printfn "First Cyclop number > 10,000,000 is %d at index %d" (Seq.item n (cyclops)) n
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-7.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-7.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
let n=primeCyclops|>Seq.findIndex(fun n->n>10000000) in printfn "First prime Cyclop number > 10,000,000 is %d at index %d" (Seq.item n (primeCyclops)) n
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-8.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-8.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
let n=blindCyclops|>Seq.findIndex(fun n->n>10000000) in printfn "First blind Cyclop number > 10,000,000 is %d at index %d" (Seq.item n (blindCyclops)) n
|
||||
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-9.fs
Normal file
1
Task/Cyclops-numbers/F-Sharp/cyclops-numbers-9.fs
Normal file
|
|
@ -0,0 +1 @@
|
|||
let n=palindromicCyclops|>Seq.findIndex(fun n->n>10000000) in printfn "First palindromic prime Cyclop number > 10,000,000 is %d at index %d" (Seq.item n (palindromicCyclops)) n
|
||||
Loading…
Add table
Add a link
Reference in a new issue