login
A364633
a(n) is the smallest nonnegative number k such that prime(n) + k is divisible by n + 1.
1
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,3
COMMENTS
The sequence presents a pattern with large discontinuities at regular intervals in the logarithmic plot (See plots in Links).
LINKS
Andres Cicuttin, Log-log plot
Andres Cicuttin, Linear plot
FORMULA
a(n) = Min_{k | (n+1) divides (prime(n)+k)}.
a(n) = (n+1)*ceiling(prime(n)/(n+1)) - prime(n)
EXAMPLE
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
MATHEMATICA
a[n_]:=Module[{k}, k=0;
While[Mod[Prime[n]+k, n+1]!=0, k++]; k];
Table[a[n], {n, 1, 70}]
PROG
(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
(PARI) a(n) = my(k=0, p=prime(n)); while ((p+k) % (n+1), k++); k; \\ Michel Marcus, Sep 05 2023
CROSSREFS
Cf. A068901.
Sequence in context: A142157 A119608 A375849 * A333513 A196646 A196601
KEYWORD
nonn,look
AUTHOR
Andres Cicuttin, Jul 30 2023
STATUS
approved