login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Numbers such that the square root of the sum of each digit cubed is equal to the digital sum of the number.
0

%I #24 Dec 30 2023 23:20:17

%S 0,1,10,12,21,22,100,102,120,123,132,201,202,210,213,220,231,312,321,

%T 333,1000,1002,1020,1023,1032,1200,1203,1224,1230,1234,1242,1243,1302,

%U 1320,1324,1342,1422,1423,1432,2001,2002,2010,2013,2020,2031,2100,2103,2124,2130,2134,2142,2143

%N Numbers such that the square root of the sum of each digit cubed is equal to the digital sum of the number.

%C Interestingly 1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789 are all terms.

%e 132 is a term since sqrt(1^3 + 3^3 + 2^3) = sqrt(36) = 6 = 1+3+2.

%p q:= n-> (l-> add(i^3, i=l)=add(i, i=l)^2)(convert(n, base, 10)):

%p select(q, [$0..2200])[]; # _Alois P. Heinz_, Dec 30 2023

%t Select[Range[0, 2200], Total[(d = IntegerDigits[#])^3] == Total[d]^2 &] (* _Amiram Eldar_, Dec 30 2023 *)

%o (Python)

%o def ok(n): return sum(d:=list(map(int, str(n))))**2==sum(di**3 for di in d)

%o print([k for k in range(2144) if ok(k)]) # _Michael S. Branicky_, Dec 30 2023

%o (PARI) isok(k) = my(d=digits(k)); vecsum(d)^2 == vecsum(apply(x->x^3, d)); \\ _Michel Marcus_, Dec 30 2023

%Y Cf. A007953, A055012.

%K nonn,base

%O 1,3

%A _Thomas Dowson_, Dec 29 2023