Perfect totient numbers: Difference between revisions
Content added Content deleted
(Added Wren) |
(add FreeBASIC) |
||
Line 213: | Line 213: | ||
{ 3, 9, 15, 27, 39, 81, 111, 183, 243, 255, 327, 363, 471, 729, 2187, 2199, 3063, 4359, 4375, 5571 } |
{ 3, 9, 15, 27, 39, 81, 111, 183, 243, 255, 327, 363, 471, 729, 2187, 2199, 3063, 4359, 4375, 5571 } |
||
</pre> |
</pre> |
||
=={{header|FreeBASIC}}== |
|||
Uses the code from the [[Totient_function#FreeBASIC|Totient Function]] example as an include. |
|||
<lang freebasic>#include"totient.bas" |
|||
dim as uinteger found = 0, curr = 3, sum, toti |
|||
while found < 20 |
|||
sum = totient(curr) |
|||
toti = sum |
|||
do |
|||
toti = totient(toti) |
|||
sum += toti |
|||
loop while toti <> 1 |
|||
if sum = curr then |
|||
print sum |
|||
found += 1 |
|||
end if |
|||
curr += 1 |
|||
wend</lang> |
|||
=={{header|Go}}== |
=={{header|Go}}== |