|
|
A345366
|
|
a(n) = (p*q+1) mod (p+q) where p=prime(n) and q=prime(n+1).
|
|
0
|
|
|
2, 0, 0, 6, 0, 12, 0, 18, 44, 0, 60, 36, 0, 42, 92, 104, 0, 120, 66, 0, 144, 78, 164, 78, 96, 0, 102, 0, 108, 192, 126, 260, 0, 264, 0, 300, 312, 162, 332, 344, 0, 348, 0, 192, 0, 170, 182, 222, 0, 228, 464, 0, 468, 500, 512, 524, 0, 540, 276, 0, 552, 552, 306
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The graph of this function consists of three branches: the upper one corresponds to cases where q-p == 2 (mod 4) except the twin primes, the middle one to cases where q-p == 0 (mod 4), and the lower one (where a(n)=0) to cases where q-p = 2, the twin primes.
All terms are even.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(1) = ( 2* 3+1) mod ( 2+ 3) = 7 mod 5 = 2,
a(2) = ( 3* 5+1) mod ( 3+ 5) = 16 mod 8 = 0,
a(3) = ( 5* 7+1) mod ( 5+ 7) = 36 mod 12 = 0,
a(4) = ( 7*11+1) mod ( 7+11) = 78 mod 18 = 6,
a(5) = (11*13+1) mod (11+13) = 144 mod 24 = 0.
|
|
MAPLE
|
a:= n-> ((p, q)-> irem(p*q+1, p+q))(map(ithprime, [n, n+1])[]):
|
|
MATHEMATICA
|
Mod[#1*#2 + 1, #1 + #2] & @@@ Partition[Select[Range[300], PrimeQ], 2, 1] (* Amiram Eldar, Jun 16 2021 *)
|
|
PROG
|
(PARI) a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q+1)%(p+q)
(Ruby) require 'prime'
values = []
Prime.first(21).each_cons(2) do |a, b|
values << (a * b + 1) % (a + b)
end
p values
(Python)
from sympy import nextprime
def aupton(nn):
alst, p, q = [], 2, 3
while len(alst) < nn: alst.append((p*q+1)%(p+q)); p, q = q, nextprime(q)
return alst
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|