What do you do?

1
2
3
4
5
6
7
8
def isfun(n):
    if n == 1:
        return True
    if n == 0:
        return False
    if (n % 3 != 0):
        return False
    return isfun(n / 3)

What does the isfun() function shown above do?

Details

n n is a non-negative integer

Returns True if n n is a power of 3 3 , False otherwise. Returns True if n n can be partitioned to 3 3 , False otherwise. Returns True if n n is a multiple of 2 2 . False, otherwise. Returns True if n n and 3 3 are co-prime, False otherwise.

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.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...