Aliquot sequence classifications: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed title for 1st section, increased title width.) |
m (→{{header|REXX}}: adjusted output width to fit Rosetta Code's window width, added whitespace to the REXX section header.) |
||
Line 2,928: | Line 2,928: | ||
Two versions of ''classifications'' of ''non-terminating'' are used: |
Two versions of ''classifications'' of ''non-terminating'' are used: |
||
::* (lowercase) '''non-terminating''' ─── due to more than sixteen cyclic numbers |
::* (lowercase) '''non-terminating''' ─── due to more than sixteen cyclic numbers |
||
::* (uppercase) '''NON-TERMINATING''' ─── due to a cyclic number that is larger than <big>2<sup>47</sup></big> |
::* (uppercase) '''NON-TERMINATING''' ─── due to a cyclic number that is larger than <big>2<sup>47</sup></big> |
||
Both of the above limitations are imposed by this Rosetta Code task's restriction requirements: ''For the purposes of this task, ···''. |
Both of the above limitations are imposed by this Rosetta Code task's restriction requirements: ''For the purposes of this task, ···''. |
||
Line 2,940: | Line 2,940: | ||
digs= digits() /*used for align numbers for the output*/ |
digs= digits() /*used for align numbers for the output*/ |
||
#.= .; #.0= 0; #.1= 0 /*#. are the proper divisor sums. */ |
#.= .; #.0= 0; #.1= 0 /*#. are the proper divisor sums. */ |
||
say center('numbers from ' low " ───► " high ' (inclusive)', |
say center('numbers from ' low " ───► " high ' (inclusive)', 153, "═") |
||
do n=low to high; call classify n /*call a subroutine to classify number.*/ |
do n=low to high; call classify n /*call a subroutine to classify number.*/ |
||
end /*n*/ /* [↑] process a range of integers. */ |
end /*n*/ /* [↑] process a range of integers. */ |
||
say |
say |
||
say center('first numbers for each classification', |
say center('first numbers for each classification', 153, "═") |
||
class.= 0 /* [↓] ensure one number of each class*/ |
class.= 0 /* [↓] ensure one number of each class*/ |
||
do q=1 until class.sociable\==0 /*the only one that has to be counted. */ |
do q=1 until class.sociable\==0 /*the only one that has to be counted. */ |
||
Line 2,950: | Line 2,950: | ||
_= what; upper _ /*obtain the class and uppercase it. */ |
_= what; upper _ /*obtain the class and uppercase it. */ |
||
class._= class._ + 1 /*bump counter for this class sequence.*/ |
class._= class._ + 1 /*bump counter for this class sequence.*/ |
||
if class._==1 then say right(q, digs) |
if class._==1 then say right(q, digs)':' center(what, digs) $ |
||
end /*q*/ /* [↑] only display the 1st occurrence*/ |
end /*q*/ /* [↑] only display the 1st occurrence*/ |
||
say /* [↑] process until all classes found*/ |
say /* [↑] process until all classes found*/ |
||
say center('classifications for specific numbers', |
say center('classifications for specific numbers', 153, "═") |
||
do i=1 for words($L) /*$L: is a list of "special numbers".*/ |
do i=1 for words($L) /*$L: is a list of "special numbers".*/ |
||
call classify word($L, i) /*call a subroutine to classify number.*/ |
call classify word($L, i) /*call a subroutine to classify number.*/ |
||
Line 2,983: | Line 2,983: | ||
if s>big then do; what= 'NON─TERMINATING'; leave; end |
if s>big then do; what= 'NON─TERMINATING'; leave; end |
||
end /*t*/ /* [↑] only permit within reason. */ |
end /*t*/ /* [↑] only permit within reason. */ |
||
if aa>0 then say right(a, digs |
if aa>0 then say right(a, digs)':' center(what, digs) $ |
||
return /* [↑] only display if AA is positive*/ |
return /* [↑] only display if AA is positive*/ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
Line 2,998: | Line 2,998: | ||
<pre style="font-size:75%"> |
<pre style="font-size:75%"> |
||
═════════════════════════════════════════════════════════numbers from 1 ───► 10 (inclusive)══════════════════════════════════════════════════════════ |
|||
═══════════════════════════════════════════════numbers from 1 ───► 10 (inclusive)════════════════════════════════════════════════ |
|||
1 |
1: terminating 0 |
||
2 |
2: terminating 1 0 |
||
3 |
3: terminating 1 0 |
||
4 |
4: terminating 3 1 0 |
||
5 |
5: terminating 1 0 |
||
6 |
6: perfect 6 |
||
7 |
7: terminating 1 0 |
||
8 |
8: terminating 7 1 0 |
||
9 |
9: terminating 4 3 1 0 |
||
10 |
10: terminating 8 7 1 0 |
||
══════════════════════════════════════════════════════════first numbers for each classification══════════════════════════════════════════════════════════ |
|||
════════════════════════════════════════════════first numbers for each classification════════════════════════════════════════════════ |
|||
1 |
1: terminating 0 |
||
6 |
6: perfect 6 |
||
25 |
25: aspiring 6 |
||
138 |
138: non─terminating 150 222 234 312 528 960 2088 3762 5598 6570 10746 13254 13830 19434 20886 21606 25098 26742 26754 |
||
220 |
220: amicable 284 220 |
||
562 |
562: cyclic 284 220 284 |
||
12496 |
12496: sociable 14288 15472 14536 14264 12496 |
||
══════════════════════════════════════════════════════════classifications for specific numbers═══════════════════════════════════════════════════════════ |
|||
════════════════════════════════════════════════classifications for specific numbers═════════════════════════════════════════════════ |
|||
11 |
11: terminating 1 0 |
||
12 |
12: terminating 16 15 9 4 3 1 0 |
||
28 |
28: perfect 28 |
||
496 |
496: perfect 496 |
||
220 |
220: amicable 284 220 |
||
1184 |
1184: amicable 1210 1184 |
||
12496 |
12496: sociable 14288 15472 14536 14264 12496 |
||
1264460 |
1264460: cyclic 1547860 1727636 1305184 1264460 1547860 |
||
790 |
790: aspiring 650 652 496 |
||
909 |
909: aspiring 417 143 25 6 |
||
562 |
562: cyclic 284 220 284 |
||
1064 |
1064: cyclic 1336 1184 1210 1184 |
||
1488 |
1488: non─terminating 2480 3472 4464 8432 9424 10416 21328 22320 55056 95728 96720 236592 459792 881392 882384 1474608 2461648 3172912 3173904 |
||
15355717786080 |
15355717786080: NON─TERMINATING 44534663601120 144940087464480 |
||
</pre> |
</pre> |
||