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.
%I A364633 #39 Sep 05 2023 12:21:50 %S A364633 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 A364633 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 A364633 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 A364633 a(n) is the smallest nonnegative number k such that prime(n) + k is divisible by n + 1. %C A364633 The sequence presents a pattern with large discontinuities at regular intervals in the logarithmic plot (See plots in Links). %H A364633 Andres Cicuttin, <a href="/A364633/a364633_2.png">Log-log plot</a> %H A364633 Andres Cicuttin, <a href="/A364633/a364633_3.png">Linear plot</a> %F A364633 a(n) = Min_{k | (n+1) divides (prime(n)+k)}. %F A364633 a(n) = (n+1)*ceiling(prime(n)/(n+1)) - prime(n) %e A364633 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 A364633 n n+1 prime(n) a(n) %e A364633 1 2 2 0 %e A364633 2 3 3 0 %e A364633 3 4 5 3 %e A364633 4 5 7 3 %e A364633 5 6 11 1 %e A364633 6 7 13 1 %e A364633 7 8 17 7 %e A364633 8 9 19 8 %e A364633 9 10 23 7 %e A364633 10 11 29 4 %t A364633 a[n_]:=Module[{k},k=0; %t A364633 While[Mod[Prime[n]+k,n+1]!=0,k++];k]; %t A364633 Table[a[n],{n,1,70}] %o A364633 (Python) %o A364633 from sympy import prime %o A364633 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 A364633 (PARI) a(n) = my(k=0, p=prime(n)); while ((p+k) % (n+1), k++); k; \\ _Michel Marcus_, Sep 05 2023 %Y A364633 Cf. A068901. %K A364633 nonn,look %O A364633 1,3 %A A364633 _Andres Cicuttin_, Jul 30 2023