Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Nov 03 2024 16:07:10
%S 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,109,119,129,139,149,
%T 159,169,179,189,199,200,300,400,500,600,700,800,900,1000,1009,1018,
%U 1027,1036,1045,1054,1063,1072,1081,1090,1109,1118,1127,1136,1145,1154,1163,1172,1181,1190,1209,1218,1227,1236
%N Numbers k whose decimal expansion starts with the sum of digits of k.
%H Harvey P. Dale, <a href="/A352461/b352461.txt">Table of n, a(n) for n = 1..1000</a>
%e 10 is a term because "10" starts with "1", which is the sum 1 + 0.
%e 119 is a term because "119" starts with "11", which is the sum 1 + 1 + 9.
%e 1018 is a term because "1018" starts with "10", which is the sum 1 + 0 + 1 + 8.
%t 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 *)
%t Select[Range[1236],StringStartsQ[ToString[#],ToString[Plus@@IntegerDigits[#]]]&] (* _Ivan N. Ianakiev_, Mar 18 2022 *)
%t Select[Range[1300],SequencePosition[IntegerDigits[#],IntegerDigits[Total[IntegerDigits[#]]]][[;;,1]]=={1}&] (* _Harvey P. Dale_, Nov 03 2024 *)
%o (Python)
%o def ok(n): s = str(n); return s.startswith(str(sum(map(int, s))))
%o print([k for k in range(1, 1237) if ok(k)]) # _Michael S. Branicky_, Mar 17 2022
%Y Cf. A052018, A352462.
%K base,nonn
%O 1,2
%A _Eric Angelini_ and _Carole Dubois_, Mar 17 2022