Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
10 LET n=27: LET s=1
|
||||
20 GO SUB 1000
|
||||
30 PRINT '"Sequence length = ";seqlen
|
||||
40 LET maxlen=0: LET s=0
|
||||
50 FOR m=2 TO 100000
|
||||
60 LET n=m
|
||||
70 GO SUB 1000
|
||||
80 IF seqlen>maxlen THEN LET maxlen=seqlen: LET maxnum=m
|
||||
90 NEXT m
|
||||
100 PRINT "The number with the longest hailstone sequence is ";maxnum
|
||||
110 PRINT "Its sequence length is ";maxlen
|
||||
120 STOP
|
||||
1000 REM Hailstone
|
||||
1010 LET l=0
|
||||
1020 IF s THEN PRINT n;" ";
|
||||
1030 IF n=1 THEN LET seqlen=l+1: RETURN
|
||||
1040 IF FN m(n,2)=0 THEN LET n=INT (n/2): GO TO 1060
|
||||
1050 LET n=3*n+1
|
||||
1060 LET l=l+1
|
||||
1070 GO TO 1020
|
||||
2000 DEF FN m(a,b)=a-INT (a/b)*b
|
||||
Loading…
Add table
Add a link
Reference in a new issue