Calculate Kaprekar-Konstante/Routine: Where is my mistake?

Hi all,

I am uncertain if this rather mathematical question belongs here so please allow me to explain it first.

In an effort to evaluate a system performance to find / suggest ideal settings for Knime (memory utilization, parallelization etc.), I had the idea to use reproducible mathematical solutions.

One example which caught my interest today, that can be rather CPU straining, is calculating the Keprekar Constant / Routine (Wikipedia english / german).

However, after computing the results for all four digit numbers which meet the initial criteria, I noticed some deviation about which I kindly like to ask if any of you spot the mistake.

The total count of valid numbers which is 8991 is met. The max. count of iterations to calculate the Keprekar constant is also seven, hence met. However, the calculated constant 6741 is met too but only for most of the numbers. For about 68 the result is zero.

Furthermore, counting the amount of numbers per iteration mostly met the criteria too but one bin, the one for five iterations, deviates.

Iteration Expectation Count*(Current Number) Criteria met
1 357 357 ok
2 519 519 ok
3 2124 2124 ok
4 1124 1124 ok
5 1311 1379 FAIL
6 1508 1508 ok
7 1980 1980 ok

Neither Wikipedia nor Google could help me understand this. Does any of you?

Here is my workflow.

Many thanks in advance

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.