Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sum of digits of p^2016 for some prime p
using Primes
plist = primes(1,10000)
sumdigits(n, base=10) = sum(digits(n, base))
for p in plist[1:100]
sdgit = sumdigits(big(p)^2016)
println("$(p), $(log(p)), $(sdgit)")
if sdgit == 2017
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.