cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A345366 a(n) = (p*q+1) mod (p+q) where p=prime(n) and q=prime(n+1).

This page as a plain text file.
%I A345366 #21 Jul 10 2021 00:23:35
%S A345366 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,
%T A345366 0,102,0,108,192,126,260,0,264,0,300,312,162,332,344,0,348,0,192,0,
%U A345366 170,182,222,0,228,464,0,468,500,512,524,0,540,276,0,552,552,306
%N A345366 a(n) = (p*q+1) mod (p+q) where p=prime(n) and q=prime(n+1).
%C A345366 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.
%C A345366 All terms are even.
%F A345366 a(n) = A023523(n+1) mod A001043(n). - _Michel Marcus_, Jun 17 2021
%e A345366 a(1) = ( 2* 3+1) mod ( 2+ 3) =   7 mod  5 = 2,
%e A345366 a(2) = ( 3* 5+1) mod ( 3+ 5) =  16 mod  8 = 0,
%e A345366 a(3) = ( 5* 7+1) mod ( 5+ 7) =  36 mod 12 = 0,
%e A345366 a(4) = ( 7*11+1) mod ( 7+11) =  78 mod 18 = 6,
%e A345366 a(5) = (11*13+1) mod (11+13) = 144 mod 24 = 0.
%p A345366 a:= n-> ((p, q)-> irem(p*q+1, p+q))(map(ithprime, [n, n+1])[]):
%p A345366 seq(a(n), n=1..63);  # _Alois P. Heinz_, Jul 03 2021
%t A345366 Mod[#1*#2 + 1, #1 + #2] & @@@ Partition[Select[Range[300], PrimeQ], 2, 1] (* _Amiram Eldar_, Jun 16 2021 *)
%o A345366 (PARI) a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q+1)%(p+q)
%o A345366 (Ruby) require 'prime'
%o A345366 values = []
%o A345366 Prime.first(21).each_cons(2) do |a, b|
%o A345366     values << (a * b + 1) % (a + b)
%o A345366 end
%o A345366 p values
%o A345366 (Python)
%o A345366 from sympy import nextprime
%o A345366 def aupton(nn):
%o A345366     alst, p, q = [], 2, 3
%o A345366     while len(alst) < nn: alst.append((p*q+1)%(p+q)); p, q = q, nextprime(q)
%o A345366     return alst
%o A345366 print(aupton(62)) # _Michael S. Branicky_, Jun 16 2021
%Y A345366 Cf. A000040, A212769, A029707 (indices of 0's).
%Y A345366 Cf. A001043, A023523.
%K A345366 nonn
%O A345366 1,1
%A A345366 _Simon Strandgaard_, Jun 16 2021