Numbers whose count of divisors is prime: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1: | Line 1: | ||
{{Draft task}} |
{{Draft task}} |
||
;Task:Find numbers which count of divisors is prime, where '''n < |
;Task:Find numbers which count of divisors is prime but not equal to 2, where '''n < 1.000''' |
||
<br><br> |
<br><br> |
||
Line 13: | Line 13: | ||
see "Numbers which count of divisors is prime are:" + nl |
see "Numbers which count of divisors is prime are:" + nl |
||
for n = 1 to |
for n = 1 to 1000 |
||
num = 0 |
num = 0 |
||
for m = 1 to n |
for m = 1 to n |
||
Line 20: | Line 20: | ||
ok |
ok |
||
next |
next |
||
if isprime(num) |
if isprime(num) and num != 2 |
||
see "" + n + " " |
see "" + n + " " |
||
row++ |
row++ |
||
Line 29: | Line 29: | ||
next |
next |
||
see nl + "Found " + row + " numbers" + nl |
|||
see "done..." + nl |
see "done..." + nl |
||
</lang> |
</lang> |
||
Line 35: | Line 36: | ||
working... |
working... |
||
Numbers which count of divisors is prime are: |
Numbers which count of divisors is prime are: |
||
4 9 16 25 49 |
|||
64 81 121 169 289 |
|||
361 529 625 729 841 |
|||
961 |
|||
37 41 43 47 49 |
|||
Found 16 numbers |
|||
53 59 61 64 67 |
|||
71 73 79 81 83 |
|||
89 97 101 103 107 |
|||
109 113 121 127 131 |
|||
137 139 149 151 157 |
|||
163 167 169 173 179 |
|||
181 191 193 197 199 |
|||
done... |
done... |
||
</pre> |
</pre> |
Revision as of 03:12, 11 July 2021
Numbers whose count of divisors is prime is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
- Find numbers which count of divisors is prime but not equal to 2, where n < 1.000
Ring
<lang ring> load "stdlib.ring" row = 0
see "working..." + nl see "Numbers which count of divisors is prime are:" + nl
for n = 1 to 1000
num = 0 for m = 1 to n if n%m = 0 num++ ok next if isprime(num) and num != 2 see "" + n + " " row++ if row%5 = 0 see nl ok ok
next
see nl + "Found " + row + " numbers" + nl see "done..." + nl </lang>
- Output:
working... Numbers which count of divisors is prime are: 4 9 16 25 49 64 81 121 169 289 361 529 625 729 841 961 Found 16 numbers done...