We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTN=int(input())val,e=0,10**10defexponent_mod(a,n,e):p=1whilen>1:ifn%2==1:p*=a%en=(n-1)a=(a**2)%en//=2return((p*a)%e)foriinrange(1,N+1):#print(exponent_mod(i, i , e), pow(i, i, e))val+=exponent_mod(i,i,e)print(val%e)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #48: Self powers
You are viewing a single comment's thread. Return to all comments →
python3 100%