Talk:Casting out nines: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 14: Line 14:


:: Given two numbers which mark the beginning and end of a range of integers [LO,HI], and an integer base (BASE), return the integers which fall in that range where the remainder after dividing the number by BASE-1 is the same as the remainder after dividing the square of the number by BASE-1.
:: Given two numbers which mark the beginning and end of a range of integers [LO,HI], and an integer base (BASE), return the integers which fall in that range where the remainder after dividing the number by BASE-1 is the same as the remainder after dividing the square of the number by BASE-1.

::: That is the test, but I also want to keep the explanation of why we are doing this. Note that Ledrug has implemented the test as ((k*k) - k)%(Base - 1) at http://rosettacode.org/wiki/Kaprekar_numbers#C which is another variation. --[[User:Nigel Galloway|Nigel Galloway]] 13:03, 27 June 2012 (UTC)


: --[[User:Rdm|Rdm]] 14:02, 26 June 2012 (UTC)
: --[[User:Rdm|Rdm]] 14:02, 26 June 2012 (UTC)