Talk:Kaprekar numbers: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Why the complexity?: Here's how I understand it)
(→‎Why the complexity?: Senility. Whot! me? Never!)
Line 14: Line 14:
Having 1 in the series seemed to add that complexity that needed explaining in my mind. --[[User:Paddy3118|Paddy3118]] 23:14, 7 June 2011 (UTC)
Having 1 in the series seemed to add that complexity that needed explaining in my mind. --[[User:Paddy3118|Paddy3118]] 23:14, 7 June 2011 (UTC)
: It has to do with the way that the splitting is done mathematically, i.e., <math>\mathit{N} = A + B</math> and <math>N^2 = A\times 10^x + B</math> where <math>10^x > B > 0</math>; in the case of <math>\mathrm{1}</math>, it becomes possible to use <math>\mathit{A} = 0</math>. This only works for that value; nothing larger is equal to itself when squared and zero is inadmissible by the constraint on <math>\mathit{B}</math>. Trust a mathematician to fluff the operation of splitting a number-string and introduce an unwanted special case! –[[User:Dkf|Donal Fellows]] 23:48, 7 June 2011 (UTC)
: It has to do with the way that the splitting is done mathematically, i.e., <math>\mathit{N} = A + B</math> and <math>N^2 = A\times 10^x + B</math> where <math>10^x > B > 0</math>; in the case of <math>\mathrm{1}</math>, it becomes possible to use <math>\mathit{A} = 0</math>. This only works for that value; nothing larger is equal to itself when squared and zero is inadmissible by the constraint on <math>\mathit{B}</math>. Trust a mathematician to fluff the operation of splitting a number-string and introduce an unwanted special case! –[[User:Dkf|Donal Fellows]] 23:48, 7 June 2011 (UTC)

::I was reading the expressions, but the implication just fazed me. I had a mental block about the 1 case, even when it was explained more explicitely. Gosh, I'm not getting senile? er, I'll change that ? to ! --[[User:Paddy3118|Paddy3118]] 09:05, 8 June 2011 (UTC)

Revision as of 09:05, 8 June 2011

Java count missing

Just add (and show), the count of how many there are <1million and you will have completed the stretch goal! --Paddy3118 14:07, 7 June 2011 (UTC)

I had actually added it as a test because I saw the other examples do it, but for some reason I didn't read it as a requirement so I took it out. Mornings are hard. --Mwn3d 14:47, 7 June 2011 (UTC)
:-)
--Paddy3118 17:29, 7 June 2011 (UTC)

Why the complexity?

The wikipedia page says "Let X be a non-negative integer. X is a Kaprekar number for base b if there exist non-negative integers n, A, and positive number B satisfying ...". In other words A can be zero. Why do we have to have a bunch of text claiming that A cannot be zero but A can be an empty string and that it is meaningful to add an empty string to a number? (Can't we just take advantage of the fact that leading zero digits do not change the value of a number?) --Rdm 20:56, 7 June 2011 (UTC)

To me the text "However a conceptual single split at the very end or before the first digit that produces one empty string does have the empty string counted" means that A can be zero. Unless I'm confused about what A and B are. --Mwn3d 22:30, 7 June 2011 (UTC)

Consider 100*100 = 10000 which could be split as 100 + 00. Now the 00 is disallowed. Compare that with 1*1 = 1 which is a K-number. For this to be a k-number then it must be expressed as either 1 plus no digists to the right or no digits to the left + 1. Either way no digits is treated as a positive integer of value zero but any string of one or more noughts is expressly forbidden.

Having 1 in the series seemed to add that complexity that needed explaining in my mind. --Paddy3118 23:14, 7 June 2011 (UTC)

It has to do with the way that the splitting is done mathematically, i.e., and where ; in the case of , it becomes possible to use . This only works for that value; nothing larger is equal to itself when squared and zero is inadmissible by the constraint on . Trust a mathematician to fluff the operation of splitting a number-string and introduce an unwanted special case! –Donal Fellows 23:48, 7 June 2011 (UTC)
I was reading the expressions, but the implication just fazed me. I had a mental block about the 1 case, even when it was explained more explicitely. Gosh, I'm not getting senile? er, I'll change that ? to ! --Paddy3118 09:05, 8 June 2011 (UTC)