login
A352461
Numbers k whose decimal expansion starts with the sum of digits of k.
3
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, 1000, 1009, 1018, 1027, 1036, 1045, 1054, 1063, 1072, 1081, 1090, 1109, 1118, 1127, 1136, 1145, 1154, 1163, 1172, 1181, 1190, 1209, 1218, 1227, 1236
OFFSET
1,2
LINKS
EXAMPLE
10 is a term because "10" starts with "1", which is the sum 1 + 0.
119 is a term because "119" starts with "11", which is the sum 1 + 1 + 9.
1018 is a term because "1018" starts with "10", which is the sum 1 + 0 + 1 + 8.
MATHEMATICA
q[n_] := Module[{d = IntegerDigits[n], s, ds, nds}, s = Plus @@ d; ds = IntegerDigits[s]; nds = Length[ds]; ds == d[[1 ;; nds]]]; Select[Range[1240], q] (* Amiram Eldar, Mar 17 2022 *)
Select[Range[1236], StringStartsQ[ToString[#], ToString[Plus@@IntegerDigits[#]]]&] (* Ivan N. Ianakiev, Mar 18 2022 *)
Select[Range[1300], SequencePosition[IntegerDigits[#], IntegerDigits[Total[IntegerDigits[#]]]][[;; , 1]]=={1}&] (* Harvey P. Dale, Nov 03 2024 *)
PROG
(Python)
def ok(n): s = str(n); return s.startswith(str(sum(map(int, s))))
print([k for k in range(1, 1237) if ok(k)]) # Michael S. Branicky, Mar 17 2022
CROSSREFS
Sequence in context: A032945 A236402 A052018 * A302768 A202272 A180480
KEYWORD
base,nonn,changed
AUTHOR
Eric Angelini and Carole Dubois, Mar 17 2022
STATUS
approved