You are viewing a single comment's thread. Return to all comments →
import math p=list(map(int,input().split())) a=p[0] b=p[1] c=p[2] d=0 for _ in range(int(input())): n=int(input()) for i in range(0,n+1): t=(a*(i**2)+b*(i)+c) if t<0: t*=(-1) if t>=2: flag=1 for j in range(2,int(math.sqrt(t))+1): if t%j==0: flag=0 break if flag==1: d+=1 print(d) d=0
normal solution
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #216: Investigating the primality of numbers of the form 2n² - 1
You are viewing a single comment's thread. Return to all comments →
normal solution