How many n?

Algebra Level 3

Find out there are how many positive integer n such that both n and n+2009 are complete squares?


The answer is 3.

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

Brock Brown
Jan 1, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def perfect_square(x):
    n = 1
    while n*n <= x:
        if n*n == x:
            return True
        n += 1
    return False
count = 0
for i in xrange(1,10000):
    if perfect_square(i*i+2009):
        count += 1
print "Answer:", count

The valid values for n are 16, 19600, and 1008016.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...