Giuga numbers: Difference between revisions
julia example
No edit summary |
(julia example) |
||
Line 24:
* [[oeis:A007850|OEIS:A007850 - Giuga numbers]]
<br><br>
=={{header|Julia}}==
<lang ruby>using Primes
isGiuga(n) = (f = factor(Vector, n); first(f) != n && all(f -> rem(n ÷ f - 1, f) == 0, f))
function getGiuga(N)
gcount = 0
for i in 4:typemax(Int)
if isGiuga(i)
println(i)
(gcount += 1) >= N && break
end
end
end
getGiuga(4)
</lang>{{out}}
<pre>
30
858
1722
66198
</pre>
=={{header|Perl}}==
|