I tried to compute the Kaprekar numbers up to 108. A simple improvement in taking the interesting part and dropping the rest: If quotient or remainder are > n the sum of both must be > n. This reduced execution time by 50 %.
Could I trouble someone to comment this code? Oops, I guess that's in the parent comment, thanks! I don't know Haskell but I'm interested in it. Does this solution work for the 'strange' ones like 4789, 5292?
Trying to wrap my head around how to interpret the definition of a Kaprekar number, in a way that includes these oddball numbers.
I'm currently studying Ruby -- I'll necro-post my Ruby solution if I manage to get it working with the oddballs.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I tried to compute the Kaprekar numbers up to 108. A simple improvement in taking the interesting part and dropping the rest: If quotient or remainder are > n the sum of both must be > n. This reduced execution time by 50 %.
Could I trouble someone to comment this code? Oops, I guess that's in the parent comment, thanks!I don't know Haskell but I'm interested in it. Does this solution work for the 'strange' ones like 4789, 5292?Trying to wrap my head around how to interpret the definition of a Kaprekar number, in a way that includes these oddball numbers.
I'm currently studying Ruby -- I'll necro-post my Ruby solution if I manage to get it working with the oddballs.