login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309120 a(n) is the least k > 1 such that n*k is adjacent to a prime. 2
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 4, 2, 2, 3, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 6, 3, 6, 5, 2, 2, 2, 2, 4, 2, 2, 2, 4, 5, 4, 2, 2, 2, 4, 2, 2, 3, 2, 2, 2, 2, 6, 2, 2, 3, 2, 2, 2, 3, 4, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
If n is odd then a(n) is even.
a(n) exists by Dirichlet's theorem on primes in arithmetic progressions.
LINKS
FORMULA
a(A104278(n)) > 2 and a(A147820(n)) = 2. - Ivan N. Ianakiev, Jul 18 2019
EXAMPLE
a(13)=4 because 4*13+1=53 is prime but none of 2*13-1,2*13+1,3*13-1,3*13+1 are primes.
MAPLE
f:= proc(m) local k;
for k from 2 by 1+(m mod 2) do
if isprime(k*m-1) or isprime(k*m+1) then return k fi
od
end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_]:=Module[{k=2}, While[Not[PrimeQ[k*n-1]||PrimeQ[k*n+1]], k++]; k];
a/@Range[94] (* Ivan N. Ianakiev, Jul 18 2019 *)
PROG
(PARI) a(n) = my(k=2); while (!isprime(n*k+1) && !isprime(n*k-1), k++); k; \\ Michel Marcus, Jul 19 2019
CROSSREFS
Sequence in context: A146167 A346622 A103380 * A098708 A067394 A337301
KEYWORD
nonn
AUTHOR
Robert Israel, Jul 17 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 4 16:30 EDT 2024. Contains 372256 sequences. (Running on oeis4.)