Factor Reactor!

Find the square root of the product of all numbers from 3 to 218 (inclusive) that have an odd number of factors (inclusive of 1 and itself).

14 ! 14! 15 ! 15! 16 ! 16! 12 ! 12! 13 ! 13! 17 ! 17!

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.

2 solutions

Brock Brown
May 28, 2015

Python 2.7:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from math import sqrt, factorial
def factors(n):
    if n == 1:
        return 1
    count = 2
    for test in xrange(2, n/2+1):
        if n % test == 0:
            count += 1
    return count
def product(numbers):
    prod = 1
    for number in numbers: prod *= number
    return prod
answer = sqrt(product([n for n in xrange(3, 219) if factors(n) % 2 != 0]))
n = 0
while factorial(n) != answer:
    n += 1
print "Answer: {0}!".format(n)

Ashwin Padaki
May 25, 2015

Numbers with odd factors are squares. 4 9 16 . . . 196 \sqrt{4 * 9 * 16 * ... * 196} = 2 * 3 * 4 * ... * 14 = 14! = 87178291200

Options would be a better choice for such large factorials

Vishnu Bhagyanath - 6 years ago

Log in to reply

Options could give the trick away...

Ashwin Padaki - 6 years ago

I know that it is the floor of 218 \sqrt{218} but why did i pick 15. Pfffttt

Jaka Ong - 6 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...