kaprekars routine
Submit
Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.
Problem
Kaprekar's routine: print the result for each iteration of this routine until 6174 or 0000.
printing must be a 4-digit number (no zero truncation)
Options
rejudge feature is enabled
now post-mortem time, all source codes will be revealed
Sample input:_
6641
Sample output:
5175
5994
5355
1998
8082
8532
6174
Sample input:_
9998
Sample output:
0999
8991
8082
8532
6174
Sample input:_
0102
Sample output:
2088
8532
6174
Ranking
| Rank | User | Size | Time | Date | Statistics |
|---|
| 1 | tails (gs) | 33 | 0.0788 | 2025/12/31 07:44:11 | 0B / 8B / 24B |
| 2 | tails () | 67 | 0.0591 | 2025/12/31 07:38:22 | 0B / 36B / 30B |
| 3 | rotary-o | 71 | 0.0705 | 2025/12/19 00:43:26 | 0B / 43B / 26B |
| Rank | User | Size | Time | Date | Statistics |
|---|
| 1 | tails (gs) | 33 | 0.0730 | 2025/12/31 07:45:17 | 0B / 8B / 24B |
| 2 | tails | 63 | 0.0498 | 2025/12/18 10:34:00 | 0B / 30B / 33B |
| 3 | teebee | 64 | 0.0749 | 2025/12/18 05:11:49 | 0B / 32B / 32B |
| 4 | Sisyphus | 65 | 0.0464 | 2025/12/18 08:40:42 | 0B / 31B / 33B |
| Rank | User | Size | Time | Date | Statistics |
|---|
| 1 | tails | 23 | 0.0761 | 2025/12/24 11:00:14 | 0B / 5B / 18B |
| Rank | User | Size | Time | Date | Statistics |
|---|
| 1 | tails | 19 | 0.2041 | 2025/12/18 17:55:31 | 5B / 7B / 5B |
| 2 | whio | 20 | 0.2022 | 2025/12/31 00:34:52 | 6B / 7B / 5B |
| 3 | tails (whio) | 17 | 0.2725 | 2025/12/31 18:13:47 | 5B / 7B / 3B |
| Rank | User | Size | Time | Date | Statistics |
|---|
| 1 | whio | 11 | 0.0523 | 2025/12/18 02:59:14 | 6B / 3B / 2B |
| 2 | tails | 11 | 0.0496 | 2025/12/18 17:13:04 | 5B / 4B / 2B |
Language Ranking_
| Rank | Lang | User | Size | Score |
| 1 | Nibbles | whio | 11 | 10000 |
| 2 | gs2 | tails (whio) | 17 | 6470 |
| 3 | GolfScript | tails | 23 | 4782 |
| 4 | Ruby | tails (gs) | 33 | 3333 |
| 5 | Perl | tails (gs) | 33 | 3333 |
| 6 | Ruby2 | rotary-o | 71 | 1549 |
| 7 | Python3 | Mukundan314 | 85 | 1294 |
| 8 | Scala | rotary-o | 88 | 1250 |
| 9 | sed | McBusLuck | 95 | 1157 |
return to the top page