Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Apr 04 2018 10:06:34
%S 1,2,8,88,131,141,232,242,888,8888,13031,13131,13231,14041,14141,
%T 14241,23032,23132,23232,24042,24142,24242,88888,888888,1303031,
%U 1304031,1313131,1314131,1323231,1324231,1403041,1404041,1413141,1414141
%N Palindromes n such that 4n + 1 is also a palindrome.
%C Among infinite subsequences are the repdigits 8...8 = 8*(10^k-1)/9. It appears that the only terms with an even number of digits are these for even k. - _Robert Israel_, Apr 04 2018
%H Robert Israel, <a href="/A083831/b083831.txt">Table of n, a(n) for n = 1..1000</a>
%e 13231 and 52925 are palindromes and 4*13231+1=52925, therefore 13231 is a term.
%p N:= 100: # to get the first N terms
%p fe:= proc(x,d) local L;
%p L:= convert(x,base,10);
%p add(L[j]*(10^(d-j)+10^(d+j-1)),j=1..d)
%p end proc:
%p fo:= proc(x,d) local L;
%p L:= convert(x,base,10);
%p add(L[j]*(10^(d-j)+10^(d+j-2)),j=2..d) + L[1]*10^(d-1);
%p end proc:
%p ispali:= proc(n) local L;
%p L:= convert(n,base,10);
%p L = ListTools:-Reverse(L)
%p end proc:
%p count:= 0: Res:= NULL:
%p for d from 1 while count < N do
%p for x from 10^(d-1) to 10^d-1 while count < N do
%p y:= fo(x,d);
%p if ispali(4*y+1) then
%p count:= count+1; Res:= Res, y;
%p fi
%p od:
%p for x from 10^(d-1) to 10^d-1 while count < N do
%p y:= fe(x,d);
%p if ispali(4*y+1) then
%p count:= count+1; Res:= Res, y;
%p fi
%p od:
%p od:
%p Res; # _Robert Israel_, Apr 04 2018
%t Select[Range[15*10^5],AllTrue[{#,4#+1},PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Mar 08 2018 *)
%o (PARI) isok(n) = my(dn = digits(n), dm = digits(4*n+1)); (Vecrev(dn) == dn) && (Vecrev(dm) == dm); \\ _Michel Marcus_, Apr 04 2018
%Y Cf. A083829, A083830, A083832.
%K base,nonn
%O 1,2
%A _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 09 2003
%E Corrected and extended by _Reinhard Zumkeller_ and _Ray Chandler_, May 18 2003