A159611 Indices of the Fermat primes in the sequence of primes.
2, 3, 7, 55, 6543
Offset: 1
Examples
3, the 1st Fermat prime is the 2nd prime, so a(1) = 2. 17, the 3rd Fermat prime is the 7th prime, so a(3) = 7.
Programs
-
Haskell
import Data.List (elemIndices) a159611 n = a159611_list !! (n-1) a159611_list = map (+ 2) $ elemIndices 0 a098006_list -- Reinhard Zumkeller, Mar 26 2013
-
Mathematica
PrimePi/@{3,5,17,257,65537} (* Harvey P. Dale, Aug 07 2022 *)
-
PARI
for(i=0, 10, isprime(f=2^2^i+1) & print1(primepi(f), ", ")) \\ Michel Marcus, Apr 28 2016
-
PARI
a152155(n) = centerlift(Mod(3, 2^(2^n)+1)^(2^(2^n-1))) print1(2, ", "); for(x=0, oo, if(a152155(x)==-1, print1(primepi(2^(2^x)+1), ", "))) \\ Felix Fröhlich, Apr 30 2021
Formula
A098006(a(n)) = 0. - Reinhard Zumkeller, Mar 26 2013
Extensions
Name edited by Felix Fröhlich, Apr 30 2021
Comments