Numbers whose count of divisors is prime: Difference between revisions
Numbers whose count of divisors is prime (view source)
Revision as of 11:46, 4 February 2024
, 3 months ago→{{header|AppleScript}}: Variable label changed. Source of squares-only idea acknowledged.
m (→{{header|AppleScript}}: Changed a couple of variable labels.) |
m (→{{header|AppleScript}}: Variable label changed. Source of squares-only idea acknowledged.) |
||
Line 163:
=={{header|AppleScript}}==
Only squares checked, as per the Discussion page.
<syntaxhighlight lang="applescript">on countFactors(n) -- Positive ns only.
if (n < 4) then return 2 - ((n = 1) as integer)
Line 189 ⟶ 190:
on task()
set limit to 100000 - 1
set
set inset to " "'s text 1 thru (
set output to {"Positive integers < " & (limit + 1) & " whose divisor count is an odd prime:"}
set row to {}
Line 198 ⟶ 199:
if (countFactors(countFactors(n)) = 2) then
set counter to counter + 1
set row's end to (inset & n)'s text -
if ((count row) = 10) then
set output's end to join(row, " ")
|