|
|
A352462
|
|
Numbers k with the property that k ends in the sum of the digits of k.
|
|
3
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 4510, 4511, 4512, 4513, 4514, 4515, 4516
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
EXAMPLE
|
a(10) = 910, which ends in 10 = 9 + 1 + 0.
a(20) = 1810, which ends in 10 = 1 + 8 + 1 + 0.
a(39) = 2719, which ends in 19 = 2 + 7 + 1 + 9.
|
|
MATHEMATICA
|
q[n_] := Module[{d = IntegerDigits[n], s, ds, nds}, s = Plus @@ d; s = IntegerDigits[s]; nds = Length[ds]; ds == d[[-nds ;; -1]]]; Select[Range[4516], q] (* Amiram Eldar, Mar 17 2022 *)
Select[Range[4516], StringEndsQ[ToString[#], ToString[Plus@@IntegerDigits[#]]]&] (* Ivan N. Ianakiev, Mar 18 2022 *)
sdkQ[n_]:=Module[{idn=IntegerDigits[n], d}, d=IntegerDigits[Total[idn]]; d==Take[idn, -Length[d]]]; Select[Range[5000], sdkQ] (* Harvey P. Dale, Apr 19 2022 *)
|
|
PROG
|
(Python)
def ok(n): s = str(n); return s.endswith(str(sum(map(int, s))))
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|