Grundy Number is a number used in Game theory which defines the state of the game. Through this concept we can define a impartial game like the (Game of Nims) in terms of Grundy.
So, before coming to Grundy Numbers , we will know about MEX which means Minimum Excludent Set.
MEX is defined as the smallest non-negative value not present in set.
So, here we are creating a set and recursively inserting in it the value n/2 , n/3 , n/6 where n is the number for which we have to find the equivalent Grundy Number.
So, basically what's the use of Grundy Numbers in Game theory when (Game of Nims) already exits for calculations , its beacuse it solves the impartials concepts of Game of Nims.
So, that's why we use the concept of Grundy Numbers and its quite easy to implement .
The Sprague-Grundy Theorem is an advanced concept ahead of Grundy Numbers.
Submitted by UDDESHYA PANKAJ (uddeshya146)
Download packets of source code on Coders Packet