Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Hailstone-sequence/Logo/hailstone-sequence.logo
Normal file
23
Task/Hailstone-sequence/Logo/hailstone-sequence.logo
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
to hail.next :n
|
||||
output ifelse equal? 0 modulo :n 2 [:n/2] [3*:n + 1]
|
||||
end
|
||||
|
||||
to hail.seq :n
|
||||
if :n = 1 [output [1]]
|
||||
output fput :n hail.seq hail.next :n
|
||||
end
|
||||
|
||||
show hail.seq 27
|
||||
show count hail.seq 27
|
||||
|
||||
to max.hail :n
|
||||
localmake "max.n 0
|
||||
localmake "max.length 0
|
||||
repeat :n [if greater? count hail.seq repcount :max.length [
|
||||
make "max.n repcount
|
||||
make "max.length count hail.seq repcount
|
||||
] ]
|
||||
(print :max.n [has hailstone sequence length] :max.length)
|
||||
end
|
||||
|
||||
max.hail 100000
|
||||
Loading…
Add table
Add a link
Reference in a new issue