Numbers whose count of divisors is prime: Difference between revisions
Content added Content deleted
(Numbers whose count of divisors is prime en PureBasic) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 7: | Line 7: | ||
Stretch goal: (as above), but where '''n < 100,000'''. |
Stretch goal: (as above), but where '''n < 100,000'''. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|FreeBASIC}} |
|||
<lang 11l>F is_prime(a) |
|||
I a == 2 |
|||
R 1B |
|||
I a < 2 | a % 2 == 0 |
|||
R 0B |
|||
L(i) (3 .. Int(sqrt(a))).step(2) |
|||
I a % i == 0 |
|||
R 0B |
|||
R 1B |
|||
print(‘Numbers which count of divisors is prime are:’) |
|||
V row = 0 |
|||
L(n) 1..99999 |
|||
V num = 0 |
|||
L(m) 1 .. n |
|||
I n % m == 0 |
|||
num++ |
|||
I is_prime(num) & num != 2 |
|||
print(‘#6’.format(n), end' ‘ ’) |
|||
row++ |
|||
I row % 5 == 0 |
|||
print() |
|||
print("\n\nFound "row‘ numbers’)</lang> |
|||
{{out}} |
|||
<pre> |
|||
Numbers which count of divisors is prime are: |
|||
4 9 16 25 49 |
|||
64 81 121 169 289 |
|||
361 529 625 729 841 |
|||
961 1024 1369 1681 1849 |
|||
2209 2401 2809 3481 3721 |
|||
4096 4489 5041 5329 6241 |
|||
6889 7921 9409 10201 10609 |
|||
11449 11881 12769 14641 15625 |
|||
16129 17161 18769 19321 22201 |
|||
22801 24649 26569 27889 28561 |
|||
29929 32041 32761 36481 37249 |
|||
38809 39601 44521 49729 51529 |
|||
52441 54289 57121 58081 59049 |
|||
63001 65536 66049 69169 72361 |
|||
73441 76729 78961 80089 83521 |
|||
85849 94249 96721 97969 |
|||
Found 79 numbers |
|||
</pre> |
|||
=={{header|Action!}}== |
=={{header|Action!}}== |