You are viewing a single comment's thread. Return to all comments →
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Project Euler #44: Pentagon numbers
You are viewing a single comment's thread. Return to all comments →
****d={}
for i in range (1,10**6 + 1) :
d[i]=int(i * ( 3*i - 1 ) /2)
n,k=list(map(int,input().split())
for i in range(k+1,n) :
if ispentagonal(d[i]-d[i-k]) or ispentagonal(d[i]+d[i-k]) :
print(d[i])