login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #39 Sep 05 2023 12:21:50

%S 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,

%T 11,1,1,33,1,31,34,33,32,33,32,31,34,29,32,33,36,29,22,23,26,27,26,29,

%U 24,23,22,21,24,23,24,27,22,13,14,17,18,9,8,3,6,7,6,3,2,1,2,1

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

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

%H Andres Cicuttin, <a href="/A364633/a364633_2.png">Log-log plot</a>

%H Andres Cicuttin, <a href="/A364633/a364633_3.png">Linear plot</a>

%F a(n) = Min_{k | (n+1) divides (prime(n)+k)}.

%F a(n) = (n+1)*ceiling(prime(n)/(n+1)) - prime(n)

%e 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:

%e n n+1 prime(n) a(n)

%e 1 2 2 0

%e 2 3 3 0

%e 3 4 5 3

%e 4 5 7 3

%e 5 6 11 1

%e 6 7 13 1

%e 7 8 17 7

%e 8 9 19 8

%e 9 10 23 7

%e 10 11 29 4

%t a[n_]:=Module[{k},k=0;

%t While[Mod[Prime[n]+k,n+1]!=0,k++];k];

%t Table[a[n],{n,1,70}]

%o (Python)

%o from sympy import prime

%o def A364633(n): return (n+1)*(prime(n)//(n+1)+1)-prime(n) if n>2 else 0 # _Chai Wah Wu_, Sep 04 2023

%o (PARI) a(n) = my(k=0, p=prime(n)); while ((p+k) % (n+1), k++); k; \\ _Michel Marcus_, Sep 05 2023

%Y Cf. A068901.

%K nonn,look

%O 1,3

%A _Andres Cicuttin_, Jul 30 2023