kaprekars routine

Submit

Your name:
File:
Open code-statistics:

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

Ruby _

RankUserSizeTimeDateStatistics
1tails (gs)330.07882025/12/31 07:44:110B / 8B / 24B
2tails ()670.05912025/12/31 07:38:220B / 36B / 30B
3rotary-o710.07052025/12/19 00:43:260B / 43B / 26B

Ruby2 _

RankUserSizeTimeDateStatistics
1rotary-o710.25952025/12/19 00:48:400B / 43B / 26B

Perl _

RankUserSizeTimeDateStatistics
1tails (gs)330.07302025/12/31 07:45:170B / 8B / 24B
2tails630.04982025/12/18 10:34:000B / 30B / 33B
3teebee640.07492025/12/18 05:11:490B / 32B / 32B
4Sisyphus650.04642025/12/18 08:40:420B / 31B / 33B

Python3 _

RankUserSizeTimeDateStatistics
1Mukundan314850.13842025/12/17 13:05:430B / 47B / 37B
2Sisyphus850.13742025/12/18 07:45:430B / 47B / 37B
3fuzzylojik910.13622025/12/20 01:29:350B / 52B / 37B

sed _

RankUserSizeTimeDateStatistics
1McBusLuck950.04512025/12/21 20:19:070B / 65B / 16B

GolfScript _

RankUserSizeTimeDateStatistics
1tails230.07612025/12/24 11:00:140B / 5B / 18B

gs2 _

RankUserSizeTimeDateStatistics
1tails190.20412025/12/18 17:55:315B / 7B / 5B
2whio200.20222025/12/31 00:34:526B / 7B / 5B
3tails (whio)170.27252025/12/31 18:13:475B / 7B / 3B

Nibbles _

RankUserSizeTimeDateStatistics
1whio110.05232025/12/18 02:59:146B / 3B / 2B
2tails110.04962025/12/18 17:13:045B / 4B / 2B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o886.11872025/12/17 23:37:100B / 64B / 19B

Language Ranking_

RankLangUserSizeScore
1Nibbleswhio1110000
2gs2tails (whio)176470
3GolfScripttails234782
4Rubytails (gs)333333
5Perltails (gs)333333
6Ruby2rotary-o711549
7Python3Mukundan314851294
8Scalarotary-o881250
9sedMcBusLuck951157

return to the top page