Oddly square

How many odd perfect squares are there from 10 to 1000?


The answer is 14.

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 26, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
def perfect(number):
    n = 1
    while n*n <= number:
        if n*n == number:
            return True
        n += 1
    return False
count = 0
for n in xrange(10,1001):
    if perfect(n):
        if n % 2 != 0:
            count += 1
print "Answer", count

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...