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.

A082806 Palindromes which are prime and the sum of the digits is also prime.

This page as a plain text file.
%I A082806 #24 Dec 07 2019 12:33:53
%S A082806 2,3,5,7,11,101,131,151,191,313,353,373,757,797,919,10301,10501,11311,
%T A082806 12721,13331,13931,14341,14741,15551,16361,16561,18181,19391,19991,
%U A082806 30103,30703,31513,32323,33533,34543,35153,35353,35753,36563,38183
%N A082806 Palindromes which are prime and the sum of the digits is also prime.
%C A082806 Most of the initial palindromic primes are members.
%C A082806 11 is the only member of even length since the sum of the digits of such palindromes is even and 2 is the only even prime. For the members of odd length the middle digit is odd (except for 2). - _Chai Wah Wu_, Aug 12 2014
%H A082806 Chai Wah Wu, <a href="/A082806/b082806.txt">Table of n, a(n) for n = 1..10000</a>
%e A082806 E.g. 12721 is a palindromic prime and 1+2+7+2+1 = 13 is also prime.
%p A082806 N:= 3: # to get all terms of at most 2*N+1 digits
%p A082806 revdigs:= proc(n)
%p A082806 local L,d;
%p A082806 L:= convert(n,base,10);
%p A082806 d:= nops(L);
%p A082806 add(L[i]*10^(d-i),i=1..d);
%p A082806 end proc:
%p A082806 pals:= proc(d)
%p A082806 local x,y;
%p A082806 seq(seq(x*10^(d+1)+y*10^d + revdigs(x),y=0..9),x=10^(d-1)..10^d-1)
%p A082806 end proc;
%p A082806 select(n -> isprime(n) and isprime(convert(convert(n,base,10),`+`)), {2,3,5,7,11,seq(pals(d),d=1..3)}); # _Robert Israel_, Aug 12 2014
%t A082806 Select[ Range[390000], PrimeQ[ # ] && FromDigits[ Reverse[ IntegerDigits[ # ]]] == # && PrimeQ[ Plus @@ IntegerDigits[ # ]] & ] (* _Robert G. Wilson v_, Jun 17 2003 *)
%o A082806 (Python)
%o A082806 from sympy import isprime
%o A082806 A082806 = sorted([n for n in chain(map(lambda x:int(str(x)+str(x)[::-1]),range(1,10**5)),map(lambda x:int(str(x)+str(x)[-2::-1]), range(1,10**5))) if isprime(n) and isprime(sum([int(d) for d in str(n)]))])
%o A082806 # _Chai Wah Wu_, Aug 12 2014
%Y A082806 Cf. A002385.
%Y A082806 Subsequence of A083393. [_Arkadiusz Wesolowski_, Sep 14 2011]
%K A082806 base,nonn
%O A082806 1,1
%A A082806 _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Apr 20 2003
%E A082806 Corrected and extended by _Giovanni Resta_, Feb 07 2006
%E A082806 Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, May 14 2007