login
Numbers n such that n-th prime is palindromic.
6

%I #28 Sep 08 2022 08:45:07

%S 1,2,3,4,5,26,32,36,42,43,65,71,74,76,129,134,138,139,157,158,1263,

%T 1285,1293,1367,1377,1483,1519,1528,1583,1635,1647,1682,1726,1805,

%U 1814,1867,1897,1917,1928,2009,2060,2083,2117,2196,2250,2260,3255,3267,3285

%N Numbers n such that n-th prime is palindromic.

%H Chai Wah Wu, <a href="/A075807/b075807.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..781 from Vincenzo Librandi, n = 782..5373 from David A. Corneth)

%F a(n) = A000720(A002385(n)). - _David A. Corneth_, Mar 24 2019

%e 26th prime is 101, which is palindromic.

%p test := proc(n) local d; d := convert(ithprime(n),base,10); return ListTools[Reverse](d)=d; end; a := []; for n from 1 to 4000 do if test(n) then a := [op(a),n]; end; od; a;

%t Rest[Flatten[Position[Prime[Range[4000]],_?(IntegerDigits[#] == Reverse[ IntegerDigits[#]]&)]]] (* _Harvey P. Dale_, Jan 26 2014 *)

%o (Magma) [n: n in [1..3500] | Intseq(NthPrime(n), 10) eq Reverse(Intseq(NthPrime(n), 10))]; // _Vincenzo Librandi_, Mar 24 2019

%o (PARI) isok(n) = my(d=digits(prime(n))); Vecrev(d) == d; \\ _Michel Marcus_, Mar 24 2019

%Y Cf. A000720, A002385, A069217.

%K nonn,base

%O 1,2

%A _Jani Melik_, Oct 13 2002

%E Edited by _Dean Hickerson_, Oct 21 2002