OFFSET
1,1
COMMENTS
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..376
EXAMPLE
The 25th term in this sequence is 1648. This means that prime(25) = 97 arises in A051686 as A051686(1648/2) = A051686(824). Thus, 1648 is the first term in the sequence {..., 2k, ...} = {1648, 1798, 4108, ...} with the property that 2k*97 + 1 = 194k + 1 is also a prime, moreover the smallest one: 159857.
MATHEMATICA
s[n_] := Module[{p = 2, i = 1}, While[! PrimeQ[2*n*p + 1], p = NextPrime[p]; i++]; i]; seq[len_] := Module[{v = Table[0, {len}], c = 0, k = 1, i}, While[c < len, i = s[k]; If[i <= len && v[[i]] == 0, v[[i]] = 2*k; c++]; k++]; v]; seq[48] (* Amiram Eldar, Feb 28 2025 *)
PROG
(PARI) a051686(n) = my(p=2); while(!isprime(2*n*p+1), p = nextprime(p+1)); p;
a(n) = my(k=1); while(a051686(k) != prime(n), k++); 2*k; \\ Michel Marcus, Jun 08 2018
(PARI) s(n) = {my(p = 2, i = 1); while(!isprime(2*n*p + 1), p = nextprime(p+1); i++); i; }
list(len) = {my(v = vector(len), c = 0, k = 1, i); while(c < len, i = s(k); if(i <= len && v[i] == 0, v[i] = 2*k; c++); k++); v; } \\ Amiram Eldar, Feb 28 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Michel Marcus, Jun 08 2018
STATUS
approved
