LastEater dies problem

Two prisoners rajesh and sai were playing a life saver game called the last eater dies.There are N cakes placed on the table as a stack,each player can take upto X cakes such that current N should be divisble by X.The person who eats the last cake dies and other player will be released from the prison.
GIven:
N : no of cakes,
player who starts first : playerName

Sample Input 1 :
4
rajesh

Output 1 :
rajesh

Sample Input 2 :
13
rajesh

Output 2:
sai

Comments (2)