Perfect totient numbers: Difference between revisions

Added Easylang
m (→‎{{header|Wren}}: Now uses totient method in Math.module.)
(Added Easylang)
Line 1,151:
{{out}}
<pre>3 9 15 27 39 81 111 183 243 255 327 363 471 729 2187 2199 3063 4359 4375 5571</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
func totient n .
tot = n
i = 2
while i <= sqrt n
if n mod i = 0
while n mod i = 0
n = n div i
.
tot -= tot div i
.
if i = 2
i = 1
.
i += 2
.
if n > 1
tot -= tot div n
.
return tot
.
n = 1
while cnt < 20
tot = n
sum = 0
while tot <> 1
tot = totient tot
sum += tot
.
if sum = n
write n & " "
cnt += 1
.
n += 2
.
</syntaxhighlight>
 
=={{header|Factor}}==
1,983

edits