Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
// Populate R and S with values of Hofstadter Figure Figure sequence. Nigel Galloway: August 28th., 2020
|
||||
let fF q=let R,S=Array.zeroCreate<int>q,Array.zeroCreate<int>q
|
||||
R.[0]<-1;S.[0]<-2
|
||||
let rec fN n g=match n=q with true->(R,S)
|
||||
|_->R.[n]<-R.[n-1]+S.[n-1]
|
||||
match S.[n-1]+1 with i when i<>R.[g]->S.[n]<-i; fN (n+1) g
|
||||
|i->S.[n]<-i+1; fN (n+1) (g+1)
|
||||
fN 1 1
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
let ffr,ffs=fF 960
|
||||
ffr|>Seq.take 10|>Seq.iter(printf "%d "); printfn ""
|
||||
|
||||
let N=Array.concat [|ffs;(Array.take 40 ffr)|] in printfn "Unique values=%d Minimum value=%d Maximum Value=%d" ((Array.distinct N).Length)(Array.min N)(Array.max N)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
let ffr,ffs=fF 10000000
|
||||
printfn "%d\n%d (Array.last ffr) (Array.last ffs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue