OFFSET
1,5
COMMENTS
LINKS
Lei Zhou, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 1, A007694(1) = 1, testing k*2-1 for k in set {1, 5, 7, 11, 13, 17, 19... }, we find that 1*1 + 1 = 2 is the first prime number found. So a(1) = 1;
In the similar way, 1*A007694(2) + 1 = 1*2 + 1 = 3 is the first prime number found for n = 2, so a(2) = 1.
...
For n = 5, A007694(5) = 8, 5*8 + 1 = 41 is the smallest prime found, so a(5) = 5.
MATHEMATICA
b = 2; a = {1, b}; sp = {1}; r = {b}; While[Length[sp] < 79, f = 0;
While[f++; (fc = FactorInteger[f];
MemberQ[{2, 3}, fc[[1, 1]]]) || (! PrimeQ[f*a[[Length[a]]] + 1])];
AppendTo[sp, f]; c = r*2; d = r*3; e = Sort[Union[c, d]]; i = 1;
While[e[[i]] <= a[[Length[a]]], i++]; AppendTo[a, e[[i]]];
AppendTo[r, e[[i]]];
While[(3*r[[1]]) < r[[Length[r]]], r = Delete[r, 1]]]; sp
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Lei Zhou, Apr 19 2017
STATUS
approved