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.

A302446 a(n) is the maximum remainder of p*q divided by p+q where p and q are primes with p <= q <= n.

Original entry on oeis.org

0, 3, 3, 7, 7, 11, 11, 11, 11, 11, 11, 23, 23, 23, 23, 23, 23, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 43, 43, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 69, 69, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 91, 91, 91, 91, 91, 91, 103, 103, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 143, 143, 143, 143
Offset: 2

Views

Author

Altug Alkan and Andres Cicuttin, Apr 08 2018

Keywords

Comments

Inspired by A302245.
While A302245 is completely predictable, this sequence behaves relatively complex.
Least positive nonsquarefree term is a(139) = 5^2*11.
If a(n) > a(n-1), then n is prime and a(n+1) = a(n). Values of a(n) such that a(n+2) > a(n+1) = a(n) > a(n-1) are 3, 7, 43, 69, 103, 259, 343, 463, 523, ...
Numbers n such that a(n) > a(n-1) are 3, 5, 7, 13, 19, 29, 31, 41, 43, 53, 59, ...

Examples

			a(2) = 0 because only option is p = q = 2.
a(3) = 3 because 3^2 mod 6 = 3 is the largest remainder.
		

Crossrefs

Programs

  • Maple
    Primes:= {}:
    A[2]:= 0:
    for n from 3 to 200 do
      if not isprime(n) then A[n]:= A[n-1]
      else
        Primes:= Primes union {n};
        A[n]:= max(A[n-1], seq(p*n mod (p+n),p=Primes))
      fi
    od:
    seq(A[n],n=2..200); # Robert Israel, Apr 08 2018
  • Mathematica
    a[n_] := Max@ Flatten@ Table[p=Prime[i]; q=Prime[j]; Mod[p q, p + q], {i, PrimePi[n]}, {j, i}]; Array[a, 75, 2]
  • PARI
    first(n) = {my(t = 1, u = nextprime(n+1), bet = vector(primepi(u)), res = List(vector(u)), p, q); forprime(p = 2, u, forprime(q = 2, p, r = (p*q) % (p+q); for(i = t, #bet, bet[i] = max(bet[i], r))); t++); t = 1; p = 2; forprime(q = 3, u, for(i = p, q - 1, res[i] = bet[t]); p = q; t++); res[u] = bet[t]; listpop(res,1); res} \\ David A. Corneth, Apr 08 2018

Formula

If A007917(n) is in A006512, then a(n) = 2*A007917(n) - 3.