Project Euler #44: Pentagon numbers

  • + 0 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])