Digit sum square

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.

Required format:
[[digits, sum], sum_2,...]

e.g

123 -> [[1, 2, 3, 6], 12]

Options

no deadline, the server will not save your submission

Sample input:_

1234
6767
8686
787
6546
123456789

Sample output:

[[1, 2, 3, 4, 10], 20, [6, 7, 6, 7, 26], 52, [8, 6, 8, 6, 28], 56, [7, 8, 7, 22], 44, [6, 5, 4, 6, 21], 42, [1, 2, 3, 4, 5, 6, 7, 8, 9, 45], 90]

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1rotary-o710.01682020/09/06 12:39:400B / 36B / 31B

Ruby2 _

RankUserSizeTimeDateStatistics
1rotary-o700.05492020/09/06 12:38:350B / 37B / 29B

Perl _

RankUserSizeTimeDateStatistics
1teebee650.01142014/07/19 11:19:010B / 24B / 40B
2BioFALSE1350.01592013/01/27 09:18:127B / 29B / 88B

Python _

RankUserSizeTimeDateStatistics
1Dingledooper640.11752021/10/10 06:44:570B / 34B / 27B
2hallvabo660.01762013/01/21 04:40:390B / 34B / 29B
3clock660.02732013/01/21 14:52:590B / 34B / 29B
4leonid660.03682013/10/05 07:11:060B / 37B / 26B
5starmie660.03162015/03/04 16:11:300B / 34B / 31B
6mitchs660.02872015/10/18 02:33:240B / 37B / 26B
7Erik the Outgolfer660.05232021/02/06 03:17:170B / 34B / 29B
8twobit680.01572013/01/20 04:47:170B / 37B / 28B
9rolf680.01712013/01/22 08:40:520B / 37B / 28B

Python3 _

RankUserSizeTimeDateStatistics
1mitchs670.05502015/10/18 02:38:160B / 34B / 31B
2Dingledooper670.17242021/10/10 06:47:010B / 34B / 31B

K _

RankUserSizeTimeDateStatistics
1teebee560.01492016/04/17 09:31:110B / 10B / 44B

C _

RankUserSizeTimeDateStatistics
1g33k1610.00022013/01/29 14:09:150B / ?B / ?B

Haskell _

RankUserSizeTimeDateStatistics
1henkma1050.01132013/01/24 23:27:270B / 54B / 43B
2cojna1100.01572013/01/24 17:22:360B / 56B / 45B

Java _

RankUserSizeTimeDateStatistics
1rotary-o1560.05012022/05/05 20:37:490B / 79B / 75B

AWK _

RankUserSizeTimeDateStatistics
1llhuii760.01052014/09/22 22:14:140B / 22B / 51B
2teebee790.01062014/07/29 16:03:080B / 26B / 49B

jq _

RankUserSizeTimeDateStatistics
1clock610.01102015/02/11 19:33:160B / 23B / 36B
2teebee810.01122014/12/15 18:04:410B / 31B / 47B

bc _

RankUserSizeTimeDateStatistics
1McBusLuck1100.01702020/09/01 16:08:200B / 47B / 56B

xgawk _

RankUserSizeTimeDateStatistics
1llhuii760.01082014/09/22 22:06:200B / 23B / 50B
2teebee790.01612014/07/29 16:08:080B / 26B / 49B

Brainfuck _

RankUserSizeTimeDateStatistics
1mitchs (cheat)1060.02492015/10/05 02:29:1711B / 24B / 59B
2g33k1860.01482013/01/29 14:12:050B / ?B / ?B

gs2 _

RankUserSizeTimeDateStatistics
1mitchs90.10182015/10/11 12:36:462B / 3B / 4B

Burlesque _

RankUserSizeTimeDateStatistics
1teebee170.01222014/09/17 06:50:390B / 8B / 9B
2Hendrik170.01252014/09/22 19:49:320B / 8B / 9B
3clock170.01202015/01/14 01:25:360B / 8B / 9B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o822.11322020/09/06 11:45:311B / 40B / 38B
2clock822.18562020/09/07 22:56:211B / 40B / 38B

Language Ranking_

RankLangUserSizeScore
1gs2mitchs910000
2Burlesqueteebee175294
3Kteebee561607
4jqclock611475
5PythonDingledooper641406
6Perlteebee651384
7Python3mitchs671343
8Ruby2rotary-o701285
9Rubyrotary-o711267
10xgawkllhuii761184
11AWKllhuii761184
12Scalarotary-o821097
13Haskellhenkma105857
14Brainfuckmitchs (cheat)106849
15bcMcBusLuck110818
16Javarotary-o156576
17Cg33k161559

return to the top page