A052018 Numbers k with the property that the sum of the digits of k is a substring of k.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 109, 119, 129, 139, 149, 159, 169, 179, 189, 199, 200, 300, 400, 500, 600, 700, 800, 900, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 1000, 1009, 1018, 1027, 1036, 1045, 1054, 1063
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Haskell
import Data.List (isInfixOf) a052018 n = a052018_list !! (n-1) a052018_list = filter f [0..] where f x = show (a007953 x) `isInfixOf` show x -- Reinhard Zumkeller, Jun 18 2013
-
Mathematica
sdssQ[n_]:=Module[{idn=IntegerDigits[n],s,len},s=Total[idn];len= IntegerLength[ s]; MemberQ[Partition[idn,len,1],IntegerDigits[s]]]; Join[{0},Select[Range[1100],sdssQ]] (* Harvey P. Dale, Jan 02 2013 *)
-
Python
loop = (str(n) for n in range(399)) print([int(n) for n in loop if str(sum(int(k) for k in n)) in n]) # Jonathan Frech, Jun 05 2017