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).

Original entry on oeis.org

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
Offset: 1

Views

Author

Simon Strandgaard, Jun 16 2021

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A000040, A212769, A029707 (indices of 0's).

Programs

  • Maple
    a:= n-> ((p, q)-> irem(p*q+1, p+q))(map(ithprime, [n, n+1])[]):
    seq(a(n), n=1..63);  # Alois P. Heinz, Jul 03 2021
  • Mathematica
    Mod[#1*#2 + 1, #1 + #2] & @@@ Partition[Select[Range[300], PrimeQ], 2, 1] (* Amiram Eldar, Jun 16 2021 *)
  • PARI
    a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q+1)%(p+q)
    
  • 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
    print(aupton(62)) # Michael S. Branicky, Jun 16 2021
  • Ruby
    require 'prime'
    values = []
    Prime.first(21).each_cons(2) do |a, b|
        values << (a * b + 1) % (a + b)
    end
    p values
    

Formula

a(n) = A023523(n+1) mod A001043(n). - Michel Marcus, Jun 17 2021