RosettaCodeData/Task/Perfect-totient-numbers/FreeBASIC/perfect-totient-numbers.basic
2023-07-01 13:44:08 -04:00

17 lines
298 B
Text

#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