Klarner-Rado sequence: Difference between revisions

m
→‎{{header|ALGOL 68}}: Added a few comments
(→‎{{header|Visual Basic .NET}}: Added some comments)
m (→‎{{header|ALGOL 68}}: Added a few comments)
Line 37:
INT max element = 100 000 000;
[ 0 : max element ]BOOL kr; FOR i FROM LWB kr TO UPB kr DO kr[ i ] := FALSE OD;
INT n21 := 3; # next 2n+1 value #
INT n31 := 4; # next 3n+1 value #
INT p2 := 1; # the n for the next 2n+1 value #
INT p3 := 1; # the n for the next 3n+1 value #
kr[ 1 ] := TRUE;
INT kr count := 0;
INT max count = 1 000 000;
FOR i WHILE kr count < max count DO
IF i = n21 THEN # found the next 2n+1 value #
IF kr[ p2 ] THEN
kr[ i ] := TRUE
Line 52:
n21 +:= 2
FI;
IF i = n31 THEN # found the next 3n+1 value #
IF kr[ p3 ] THEN
kr[ i ] := TRUE
3,038

edits