cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A352461 Numbers k whose decimal expansion starts with the sum of digits of k.

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