6 kyu

Twisted Sum

1,088 of 6,017agram

Description:

Find the sum of the digits of all the numbers from 1 to N (both ends included).

Examples

# N = 4
1 + 2 + 3 + 4 = 10

# N = 10
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + (1 + 0) = 46

# N = 12
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + (1 + 0) + (1 + 1) + (1 + 2) = 51
Mathematics
Algorithms

More By Author:

Check out these other kata created by agram

Stats:

CreatedNov 9, 2013
PublishedNov 9, 2013
Warriors Trained9251
Total Skips582
Total Code Submissions23983
Total Times Completed6017
Ruby Completions1088
C# Completions605
Python Completions2563
Clojure Completions57
F# Completions37
C Completions224
Groovy Completions62
JavaScript Completions1494
CoffeeScript Completions11
Crystal Completions9
Julia Completions20
COBOL Completions11
Factor Completions10
Total Stars134
% of votes with a positive feedback rating94% of 795
Total "Very Satisfied" Votes706
Total "Somewhat Satisfied" Votes80
Total "Not Satisfied" Votes8
Ad
Contributors
  • agram Avatar
  • jhoffner Avatar
  • Anseltis Avatar
  • suic Avatar
  • anter69 Avatar
  • jetjake Avatar
  • kazk Avatar
  • B1ts Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • testfirstcoder Avatar
  • bornForThis Avatar
  • lsnbr Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
Ad