cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A083831 Palindromes n such that 4n + 1 is also a palindrome.

This page as a plain text file.
%I A083831 #21 Apr 04 2018 10:06:34
%S A083831 1,2,8,88,131,141,232,242,888,8888,13031,13131,13231,14041,14141,
%T A083831 14241,23032,23132,23232,24042,24142,24242,88888,888888,1303031,
%U A083831 1304031,1313131,1314131,1323231,1324231,1403041,1404041,1413141,1414141
%N A083831 Palindromes n such that 4n + 1 is also a palindrome.
%C A083831 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 A083831 Robert Israel, <a href="/A083831/b083831.txt">Table of n, a(n) for n = 1..1000</a>
%e A083831 13231 and 52925 are palindromes and 4*13231+1=52925, therefore 13231 is a term.
%p A083831 N:= 100: # to get the first N terms
%p A083831 fe:= proc(x,d) local L;
%p A083831    L:= convert(x,base,10);
%p A083831    add(L[j]*(10^(d-j)+10^(d+j-1)),j=1..d)
%p A083831 end proc:
%p A083831 fo:= proc(x,d) local L;
%p A083831   L:= convert(x,base,10);
%p A083831   add(L[j]*(10^(d-j)+10^(d+j-2)),j=2..d) + L[1]*10^(d-1);
%p A083831 end proc:
%p A083831 ispali:= proc(n) local L;
%p A083831    L:= convert(n,base,10);
%p A083831    L = ListTools:-Reverse(L)
%p A083831 end proc:
%p A083831 count:= 0: Res:= NULL:
%p A083831 for d from 1 while count < N do
%p A083831   for x from 10^(d-1) to 10^d-1 while count < N do
%p A083831     y:= fo(x,d);
%p A083831   if ispali(4*y+1) then
%p A083831      count:= count+1; Res:= Res, y;
%p A083831   fi
%p A083831 od:
%p A083831 for x from 10^(d-1) to 10^d-1 while count < N do
%p A083831     y:= fe(x,d);
%p A083831   if ispali(4*y+1) then
%p A083831      count:= count+1; Res:= Res, y;
%p A083831   fi
%p A083831 od:
%p A083831 od:
%p A083831 Res; # _Robert Israel_, Apr 04 2018
%t A083831 Select[Range[15*10^5],AllTrue[{#,4#+1},PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Mar 08 2018 *)
%o A083831 (PARI) isok(n) = my(dn = digits(n), dm = digits(4*n+1)); (Vecrev(dn) == dn) && (Vecrev(dm) == dm); \\ _Michel Marcus_, Apr 04 2018
%Y A083831 Cf. A083829, A083830, A083832.
%K A083831 base,nonn
%O A083831 1,2
%A A083831 _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 09 2003
%E A083831 Corrected and extended by _Reinhard Zumkeller_ and _Ray Chandler_, May 18 2003