Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
⍝ recursive dfn:
dfnHailstone{
c ⍝ last element
1=c:1 ⍝ if it is 1, stop.
,(1+2|c)(c÷2)(1+3×c) ⍝ otherwise pick the next step, and append the result of the recursive call
}
⍝ tradfn version:
seqhailstone n;next
⍝ Returns the hailstone sequence for a given number
seqn ⍝ Init the sequence
:While n1
next(n÷2) (1+3×n) ⍝ Compute both possibilities
nnext[1+2|n] ⍝ Pick the appropriate next step
seq,n ⍝ Append that to the sequence
:EndWhile

View file

@ -0,0 +1,10 @@
dfnHailstone 5
5 16 8 4 2 1
5hailstone 27
27 82 41 124 62
¯5hailstone 27
16 8 4 2 1
hailstone 27
112
1{[(hailstone)¨]}100000
77031