login
Numbers k such that (k*(k+1)*(k+2)) / (k+(k+1)+(k+2)) is a palindrome.
2

%I #22 Jan 25 2022 08:30:38

%S 0,1,3,4,9,21,42,99,154,237,405,999,9999,18991,19291,22021,23587,

%T 40293,45072,99999,137652,999999,1278343,1360456,3162199,3162499,

%U 4029705,4365396,4418236,6052891,9999999,31496589,40289205,41276535,44295036,56353251,99999999

%N Numbers k such that (k*(k+1)*(k+2)) / (k+(k+1)+(k+2)) is a palindrome.

%C Equivalently, numbers k such that (2k + k^2)/3 is a palindrome. - _Harvey P. Dale_, Sep 02 2015

%C For all i >= 1, 9^i is a term with corresponding quotient 3^{2*i}, where ^ is repeated concatenation. - _Michael S. Branicky_, Jan 24 2022

%H Michael S. Branicky, <a href="/A032789/b032789.txt">Table of n, a(n) for n = 1..48</a>

%t palQ[n_]:=Module[{c=(2n+n^2)/3,id},id=If[IntegerQ[c],IntegerDigits[c],{1,2}];id==Reverse[id]]; Select[Range[0,10^7],palQ] (* _Harvey P. Dale_, Sep 02 2015 *)

%o (Python)

%o from itertools import count, islice

%o def ispal(n): s = str(n); return s == s[::-1]

%o def agen():

%o for k in count(0):

%o q, r = divmod(k*(k+2), 3)

%o if r == 0 and ispal(q):

%o yield k, q

%o print([k for k, q in islice(agen(), 31)]) # _Michael S. Branicky_, Jan 24 2022

%Y Cf. A002113, A032790.

%K nonn,base

%O 1,3

%A _Patrick De Geest_, May 15 1998

%E Definition clarified by _Harvey P. Dale_, Sep 02 2015

%E a(32) and beyond from _Michael S. Branicky_, Jan 24 2022