Inspried by Satyajit Mohanty

Let S S be the set of numbers less than 5 5 billions and can be expressed in the form n 2 + 5 n + 23 n^2+5n+23 , where n n is a positive integer.

Let N N be the smallest prime number that divides for some elements of S S .

Let p p be the number of elements of S S that are prime.

Let q q be the number of elements of S S that are divisible by N N .

Find N + p + q N+p+q .

Inspiration .


The answer is 19663.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Pranjal Jain
Mar 30, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from sympy import isprime
S=set()
i=1
def f(n):
    return n*n+5*n+23
while True:
    x=f(i)
    if x>=5*10**9:
        break
    S.add(x)
    i+=1
N=29    #for n=1, f(n)=29 which is prime
p=sum(1 for i in S if isprime(i))
q=sum(1 for i in S if i%N==0)
print(N+p+q)   #Prints 19663

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...