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,k=map(int,input().split())primes={0:2,1:3,2:5,3:7,4:11,5:13,6:17,7:19,8:23,9:29}defrootval(n):s=1whilen>0:s*=primes[n%10]n=n//10return(s)n=125874whilen<=N:tmp,val=[n],rootval(n)foriinrange(2,k+1):ifval==rootval(n*i):tmp.append(n*i)else:breakelse:print(*tmp)n+=1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #52: Permuted multiples
You are viewing a single comment's thread. Return to all comments →
100% python3