Square Root Everywhere

In his dream, Chris wrote a function in Python, which takes a positive integer as the parameter.

1
2
3
4
5
6
7
def func(n):
    if n == 1:
        return 1
    val = 0
    for i in range(int(sqrt(n))):
        val += func(int(sqrt(n)))
    return val

How many distinct inputs n n are there such that this function returns 627372?


The answer is 2827.

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

By a examination of the code,the loop withing the function definition is just a multiplication and the function switches values at values which are squares of integers.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...