Attractive numbers: Difference between revisions

Added 11l
(Undo revision 334616 by Not a robot (talk))
(Added 11l)
Line 15:
:*   The OEIS entry:   [[oeis:A063989|A063989: Numbers with a prime number of prime divisors]].
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F is_prime(n)
I n < 2
R 0B
L(i) 2 .. Int(sqrt(n))
I n % i == 0
R 0B
R 1B
 
F get_pfct(=n)
V i = 2
[Int] factors
L i * i <= n
I n % i
i++
E
n I/= i
factors.append(i)
I n > 1
factors.append(n)
R factors.len
 
[Int] pool
 
L(each) 0..120
pool.append(get_pfct(each))
 
[Int] r
L(each) pool
I is_prime(each)
r.append(L.index)
 
print(r.map(String).join(‘,’))</lang>
 
{{out}}
<pre>
4,6,8,9,10,12,14,15,18,20,21,22,25,26,27,28,30,32,33,34,35,38,39,42,44,45,46,48,49,50,51,52,55,57,58,62,63,65,66,68,69,70,72,74,75,76,77,78,80,82,85,86,87,91,92,93,94,95,98,99,102,105,106,108,110,111,112,114,115,116,117,118,119,120
</pre>
 
=={{header|8080 Assembly}}==
1,481

edits