Digit sum square REVISED

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

Given a number abcd (where a,b,c,d are digits)
calculate the digit sum a+b+c+d and concatenate the digit sum
to the original number and calculate the digit sum again.

1234 -> 1+2+3+4 = 10 -> 123410
12310 -> 10+1+0 = 11

Options

no deadline, the server will not save your submission

Sample input:_

1234
767
12454
344234
32765
77
8768
348762847283284764298
34324
131233
689162
447943847
987654321
123456789
13579
24680
1137
1227
10110101

Sample output:

[11, 22, 23, 22, 28, 19, 40, 116, 23, 17, 37, 55, 54, 54, 32, 22, 15, 15, 10]

Sample input:_

4321
30030330303
1331415

Sample output:

[11, 27, 27]

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid460.02442013/01/24 08:44:090B / 19B / 27B
2clock460.02212013/01/24 15:33:270B / 21B / 25B
3Histocrat660.02432013/01/22 06:20:530B / ?B / ?B

Perl _

RankUserSizeTimeDateStatistics
1teebee560.02302014/07/19 18:19:310B / 21B / 34B
2BioFALSE850.02242013/01/27 09:01:330B / 29B / 54B

Python _

RankUserSizeTimeDateStatistics
1leonid520.03372013/01/25 04:30:5214B / 22B / 14B
2hallvabo (embed)520.05902013/06/03 07:24:3314B / 22B / 14B
3mitchs520.05482014/07/19 18:34:1214B / 22B / 14B
4teebee520.09822014/07/19 19:03:2814B / 22B / 14B
5clock(embed)530.03542013/01/25 13:11:4913B / 22B / 16B
6clock740.03942013/01/24 16:08:240B / 39B / 32B
7hallvabo790.04942013/01/21 05:18:090B / 44B / 32B
8rolf810.04122013/01/31 19:09:340B / 54B / 23B
9twobit820.04542013/01/20 05:40:340B / 46B / 32B
10Volatility920.04592013/01/22 10:48:352B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1pooq980.14032013/01/20 12:04:170B / 56B / 34B

JavaScript _

RankUserSizeTimeDateStatistics
1madshall980.02592013/07/26 23:53:550B / 45B / 52B
2_nderscore1100.02582013/07/26 10:16:240B / 60B / 48B

K _

RankUserSizeTimeDateStatistics
1teebee410.02282014/12/25 10:45:010B / 6B / 34B

C _

RankUserSizeTimeDateStatistics
1g33k1270.02142013/01/29 14:08:040B / ?B / ?B

Haskell _

RankUserSizeTimeDateStatistics
1cojna860.02802013/04/22 00:04:520B / 52B / 28B
2henkma860.03032013/04/22 20:35:450B / 52B / 28B

AWK _

RankUserSizeTimeDateStatistics
1llhuii700.02112014/07/31 23:59:390B / 31B / 38B
2teebee730.02132014/07/30 03:27:070B / 31B / 41B

jq _

RankUserSizeTimeDateStatistics
1clock690.02202015/02/11 19:33:220B / 28B / 38B

xgawk _

RankUserSizeTimeDateStatistics
1llhuii700.02172014/08/01 00:41:330B / 31B / 38B
2teebee730.02152014/07/30 03:29:560B / 31B / 41B

Brainfuck _

RankUserSizeTimeDateStatistics
1g33k1630.02682013/01/29 14:46:140B / ?B / ?B

GolfScript _

RankUserSizeTimeDateStatistics
1clock300.06592013/01/20 06:30:340B / 2B / 27B
2tails300.05422013/01/23 22:37:060B / 5B / 24B
3leonid320.04482013/01/24 09:24:070B / 5B / 26B
4twobit340.06022013/01/20 06:48:490B / 7B / 26B
5%20340.04432015/09/12 20:15:560B / 2B / 31B
6nooodl350.04552013/01/21 01:39:000B / ?B / ?B
7%20(symbol)390.05042015/09/12 20:36:320B / 0B / 37B

gs2 _

RankUserSizeTimeDateStatistics
1mitchs90.17142015/09/12 04:19:291B / 4B / 4B

FlogScript _

RankUserSizeTimeDateStatistics
1milieu270.06952013/01/24 15:21:060B / ?B / ?B
2clock270.06162013/03/06 02:29:450B / 5B / 21B

Burlesque _

RankUserSizeTimeDateStatistics
1teebee170.02862014/09/17 06:28:310B / 8B / 9B
2Hendrik170.02692014/09/22 19:50:530B / 8B / 9B
3clock170.02652015/01/14 01:26:160B / 8B / 9B
4mroman180.02572013/01/20 03:58:080B / 7B / 11B

Vim _

RankUserSizeTimeDateStatistics
1clock570.05152013/02/04 08:40:249B / 20B / 23B

Logo _

RankUserSizeTimeDateStatistics
1teebee810.02662014/01/06 02:34:430B / 51B / 14B
2clock820.02842013/03/09 01:09:200B / 52B / 20B

Language Ranking_

RankLangUserSizeScore
1gs2mitchs910000
2Burlesqueteebee175294
3FlogScriptmilieu273333
4GolfScriptclock303000
5Kteebee412195
6Rubyleonid461956
7Pythonleonid521730
8Perlteebee561607
9Vimclock571578
10jqclock691304
11AWKllhuii701285
12xgawkllhuii701285
13Logoteebee811111
14Haskellcojna861046
15Iopooq98918
16JavaScriptmadshall98918
17Cg33k127708
18Brainfuckg33k163552

return to the top page