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.

A364633 a(n) is the smallest nonnegative number k such that prime(n) + k is divisible by n + 1.

Original entry on oeis.org

0, 0, 3, 3, 1, 1, 7, 8, 7, 4, 5, 2, 1, 2, 1, 15, 13, 15, 13, 13, 15, 13, 13, 11, 7, 7, 9, 9, 11, 11, 1, 1, 33, 1, 31, 34, 33, 32, 33, 32, 31, 34, 29, 32, 33, 36, 29, 22, 23, 26, 27, 26, 29, 24, 23, 22, 21, 24, 23, 24, 27, 22, 13, 14, 17, 18, 9, 8, 3, 6, 7, 6, 3, 2, 1, 2, 1
Offset: 1

Views

Author

Andres Cicuttin, Jul 30 2023

Keywords

Comments

The sequence presents a pattern with large discontinuities at regular intervals in the logarithmic plot (See plots in Links).

Examples

			The following table shows the first 10 terms where the fourth column, a(n), plus the third column, prime(n), is divisible by the second column n+1:
   n   n+1 prime(n) a(n)
   1    2     2       0
   2    3     3       0
   3    4     5       3
   4    5     7       3
   5    6    11       1
   6    7    13       1
   7    8    17       7
   8    9    19       8
   9   10    23       7
  10   11    29       4
		

Crossrefs

Cf. A068901.

Programs

  • Mathematica
    a[n_]:=Module[{k},k=0;
    While[Mod[Prime[n]+k,n+1]!=0,k++];k];
    Table[a[n],{n,1,70}]
  • PARI
    a(n) = my(k=0, p=prime(n)); while ((p+k) % (n+1), k++); k; \\ Michel Marcus, Sep 05 2023
  • Python
    from sympy import prime
    def A364633(n): return (n+1)*(prime(n)//(n+1)+1)-prime(n) if n>2 else 0 # Chai Wah Wu, Sep 04 2023
    

Formula

a(n) = Min_{k | (n+1) divides (prime(n)+k)}.
a(n) = (n+1)*ceiling(prime(n)/(n+1)) - prime(n)