Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
hailstone[1] = {1};
|
||||
hailstone[n_] :=
|
||||
hailstone[n] = Prepend[hailstone[If[EvenQ[n], n/2, 3 n + 1]], n];
|
||||
If[$ScriptCommandLine[[1]] == $Input,
|
||||
val = hailstone[27];
|
||||
Print["hailstone(27) starts with ", val[[;; 4]], ", ends with ",
|
||||
val[[-4 ;;]], ", and has length ", Length[val], "."];
|
||||
val = MaximalBy[Range[99999], Length@*hailstone][[1]];
|
||||
Print[val, " has the longest hailstone sequence with length ",
|
||||
Length[hailstone[val]], "."]];
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<< hailstone.m;
|
||||
Print["The most common hailstone length is ",
|
||||
Commonest[Length@*hailstone /@ Range[99999]][[1]], "."];
|
||||
Loading…
Add table
Add a link
Reference in a new issue