OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
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
KEYWORD
base,nonn,changed
AUTHOR
Eric Angelini and Carole Dubois, Mar 17 2022
STATUS
approved