login
Numbers with at least three digits and with the property that the sum of the squares of the first and last digits equals the number obtained when the first and last digits are deleted.
3

%I #40 Jul 24 2016 20:15:01

%S 110,121,152,240,251,282,390,1103,1174,1265,1376,1507,1658,1829,2133,

%T 2204,2295,2406,2537,2688,2859,3101,3132,3183,3254,3345,3456,3587,

%U 3738,3909,4160,4171,4202,4253,4324,4415,4526,4657,4808,4979,5250,5261,5292,5343,5414,5505,5616

%N Numbers with at least three digits and with the property that the sum of the squares of the first and last digits equals the number obtained when the first and last digits are deleted.

%C More precisely, numbers n = d_1 d_2 d_3 ... d_k such that d_2 is not zero, and (d_1)^2 + (d_k)^2 = d_2 d_3 ... d_{k-1}.

%C This version differs from Banerjee's because he does allow d_2 to be zero (we do not) and he starts with 5-digit numbers.

%C See A274945 for the version where d_2 may be zero.

%H Michel Marcus, <a href="/A274944/b274944.txt">Table of n, a(n) for n = 1..90</a>

%H Biswarup Banerjee, <a href="https://biswarupbanerjee.quora.com/The-StairCase-Sequence">The Staircase Sequence</a>

%e 1174 is a term because 1^2+4^2 = 17.

%e 81137 is a term because 8^2+7^2 = 113.

%e 91629 is the largest term, since the middle digits cannot be larger than 2*9^2 = 162.

%o (PARI) isok(n) = {d = digits(n); if ((#d >=3) && d[2], nd = vector(#d-2, k, d[k+1]); d[1]^2 + d[#d]^2 == subst(Pol(nd), x, 10););} \\ _Michel Marcus_, Jul 23 2016

%o (Python)

%o A274944_list = [j*10**(i+1)+10*(j**2+k**2)+k for i in range(1,4) for j in range(1,10) for k in range(10) if 10**(i-1) <= j**2+k**2 < 10**i] # _Chai Wah Wu_, Jul 23 2016

%o (Python)

%o A274944_list = sorted([int(str(i)+str(i**2+j**2)+str(j)) for i in range(1,10) for j in range(10)]) # slightly shorter implementation _Chai Wah Wu_, Jul 24 2016

%Y Cf. A274945.

%K nonn,base,fini,full

%O 1,1

%A _N. J. A. Sloane_, Jul 23 2016, based on an email from Biswarup Banerjee.

%E More terms from _Michel Marcus_, Jul 23 2016