All the numbers from 1 to infinity are written in sequence:

1,2,3,4,5,6,7,8,9,10,11,12,13,14.....
in the first iteration, every second number is removed, leaving:
1,3,5,7,9,11,13....
in the second iteration, every third number in the above sequence is
removed, thus leaving: 1,3,7,9,13....
in the third iteration, every fourth number is removed, leaving:
1,3,7,13....
like this the process goes on indefinitely.
the numbers which are, thus, left are called lucky numbers.

Given a number n(can be as big as 18 digits) you must tell if n is a
lucky number or not.. how do i proceed?? all that i can think of is a
naive implementation which obviously wont work because n can be as big
as 18 digits...
could you help me or give suggestions on how to proceed....
(This question was asked in a practice contest which is over now)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to