%I #13 Jan 17 2023 18:29:52
%S 2,11,19,23,31,47,79,83,211,227,263,271,307,311,347,379,383,419,547,
%T 563,571,587,619,683,691,727,743,751,787,823,827,859,863,991,1091,
%U 1123,1187,1223,1231,1427,1459,1523,1531,1567,1571,1579,1583,1619,1627,1663,1667
%N a(1) = 2; for n>1, a(n) = smallest prime p such that p - a(n-1) = a^b for some positive integers a,b > 1.
%H T. D. Noe, <a href="/A079062/b079062.txt">Table of n, a(n) for n=1..1000</a>
%e Start with 2. 2 + 3^2 = 11 is a prime and there is no smaller such prime, so 11 is the next number. 11 + 2^3 = 19 is a prime and there is no smaller such prime, so 19 comes next, etc.
%t a[1] = 2; a[n_] := a[n] = Catch[ For[p = NextPrime[a[n-1]], True, p = NextPrime[p], q = p - a[n-1]; test = Catch[ Do[ If[q == a^b, Throw[True]], {a, 2, Ceiling[Sqrt[q]]}, {b, 2, Ceiling[Log[2, q]]}]]; If[test === True, Throw[p]]]]; Table[a[n], {n, 1, 35}] (* _Jean-François Alcover_, Jul 13 2012 *)
%o (Haskell)
%o a079062 n = a079062_list !! (n-1)
%o a079062_list = 2 : f 2 (tail a000040_list) where
%o f x ps = q : f q qs where
%o (q:qs) = dropWhile (\p -> a075802 (p - x) == 0 || p - x == 1) ps
%o -- _Reinhard Zumkeller_, Jun 14 2013
%Y Cf. A075802, A000040.
%K nice,nonn
%O 1,1
%A _Fabian Rothelius_, Feb 02 2003
|