%I #42 Jun 30 2017 15:57:37
%S 110,121,152,240,251,282,390,1010,1021,1052,1103,1174,1265,1376,1507,
%T 1658,1829,2040,2051,2082,2133,2204,2295,2406,2537,2688,2859,3090,
%U 3101,3132,3183,3254,3345,3456,3587,3738,3909,4160,4171,4202,4253,4324,4415,4526,4657,4808,4979,5250,5261,5292,5343,5414,5505,5616
%N The Staircase Sequence: 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_1)^2 + (d_k)^2 = d_2 d_3 ... d_{k-1}. The inner number d_2 d_3 ... d_{k-1} may begin with an initial string of zeros.
%C This sequence is infinite (it contains the numbers 1000...00010).
%C See A274944 for the (finite) version where d_2 may not be zero.
%C For k > 4, there are 90 terms in the sequence with k decimal digits. - _Enrique Pérez Herrero_, Jun 25 2017.
%H Chai Wah Wu, <a href="/A274945/b274945.txt">Table of n, a(n) for n = 1..10073</a>
%H Biswarup Banerjee, <a href="https://biswarupbanerjee.quora.com/The-StairCase-Sequence">The Staircase Sequence</a>
%F a(n) = 11*a(n-90) - 10*a(n-180) for n > 263. - _Chai Wah Wu_, Jul 24 2016
%F From _Enrique Pérez Herrero_, Jun 25 2017: (Start)
%F a(n) = i(n)*10^(D_10(n)-1) + (i(n)^2+j(n)^2)*10 + j(n) for n > 83, where:
%F D_10(n) = floor((n+366)/90) is the number of decimal digits of a(n).
%F i(n) = 1+floor((n+366)/10)-9*D_10(n) is the first decimal digit of a(n).
%F j(n) = (n-4)-10*floor((n-4)/10) is the last decimal digit of a(n).
%F (End)
%e 1174 is a term because 1^2 + 4^2 = 17.
%e 81137 is a term because 8^2 + 7^2 = 113.
%t Select[Range[10^2, 6000], First[#]^2 + Last[#]^2 == FromDigits@ Most@ Rest@ # &@ IntegerDigits@ # &] (* _Michael De Vlieger_, Jun 27 2017 *)
%o (Python)
%o A274945_list = [j*10**(i+1)+10*(j**2+k**2)+k for i in range(1,10) for j in range(1,10) for k in range(10) if j**2+k**2 < 10**i] # _Chai Wah Wu_, Jul 23 2016
%o (PARI) isokb(n) = {d = digits(n); if ((#d >=3), nd = vector(#d-2, k, d[k+1]); d[1]^2 + d[#d]^2 == subst(Pol(nd), x, 10););} \\ _Michel Marcus_, Jul 24 2016
%Y Cf. A274944.
%K nonn,base
%O 1,1
%A _N. J. A. Sloane_, Jul 23 2016, based on an email from Biswarup Banerjee