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.
Project Euler #44: Pentagon numbers
Project Euler #44: Pentagon numbers
Sort by
recency
|
39 Discussions
|
Please Login in order to post a comment
Simple solution in Python 3 :
JAva code
Accurate and Perfect solution of this problme
****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])
from math import sqrt :
def ispentagonal(a) :