What if we create a base 3 number from the given number N and then check if
there is only 1 bit with value 1 and all values should be 0. For example, if
lets say the number is 27. Its base 3 number will be 1 0 0 0, now since there
is only 1 single 1 present in this representation, it is a power
It might be useful:
http://www.artofproblemsolving.com/Wiki/index.php/Partition_%28combinatorics%29
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/hymA4xyv
I think 2^(n-1) - 1
On Tue, Aug 16, 2011 at 8:36 PM, sameer gupta wrote:
> no. of ways you can write a no. as sum of other non-zero positive
> integers
> like 3 can be written in
> 3 ways:
> 1+1+1,
> 1+2
> 2+1
> imp. 2+1 and 1+2 are different
> find the answer and give and prove formula for any