Sequence: smallest number greater than previous term with exactly n divisors: Difference between revisions

Added solution for Action!
(Added R.)
(Added solution for Action!)
Line 68:
4288
4624
</pre>
 
=={{header|Action!}}==
Calculations on a real Atari 8-bit computer take quite long time. It is recommended to use an emulator capable with increasing speed of Atari CPU.
<lang Action!>CARD FUNC CountDivisors(CARD a)
CARD i,count
 
i=1 count=0
WHILE i*i<=a
DO
IF a MOD i=0 THEN
IF i=a/i THEN
count==+1
ELSE
count==+2
FI
FI
i==+1
OD
RETURN (count)
 
PROC Main()
CARD a
BYTE i
 
a=1
FOR i=1 TO 15
DO
WHILE CountDivisors(a)#i
DO
a==+1
OD
IF i>1 THEN
Print(", ")
FI
PrintC(a)
OD
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Sequence_smallest_number_greater_than_previous_term_with_exactly_n_divisors.png Screenshot from Atari 8-bit computer]
<pre>
1, 2, 4, 6, 16, 18, 64, 66, 100, 112, 1024, 1035, 4096, 4288, 4624
</pre>
 
Anonymous user