Deceptive numbers: Difference between revisions

m
Line 37:
;* [[oeis:A000864|OEIS:A000864 - Deceptive nonprimes: composite numbers k that divide the repunit R_{k-1}]]
<br>
 
 
=={{header|Julia}}==
<lang julia>using Primes
 
function deceptives(numwanted)
n, ret = 2, Int[]
while length(ret) < numwanted
if !isprime(n)
r = evalpoly(big"10", [1 for _ in 1:n-1])
r % n == 0 && push!(ret, n)
end
n += 1
end
return ret
end
 
println(deceptives(10)) # [91, 259, 451, 481, 703, 1729, 2821, 2981, 3367, 4141]
</lang>
 
 
4,111

edits