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 A013632 #57 Nov 29 2023 13:49:57 %S A013632 2,1,1,2,1,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2,1,6,5,4, %T A013632 3,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,2,1,6,5,4,3,2,1,4, %U A013632 3,2,1,2,1,6,5,4,3,2,1,4,3,2,1,6,5,4,3,2,1,8,7,6,5,4,3,2,1,4,3,2,1,2,1,4,3 %N A013632 Difference between n and the next prime greater than n. %C A013632 Alternatively, a(n) is the smallest positive k such that n + k is prime. - _N. J. A. Sloane_, Nov 18 2015 %C A013632 Except for a(0) and a(1), a(n) is the least k such that gcd(n!, n + k) = 1. - _Robert G. Wilson v_, Nov 05 2010 %C A013632 This sequence uses the "strictly larger" variant A151800 of the nextprime function, rather than A007918. Therefore all terms are positive and a(n) = 1 if and only if n + 1 is a prime. - _M. F. Hasler_, Sep 09 2015 %C A013632 For n > 0, a(n) and n are of opposite parity. Also, by Bertrand's postulate (actually a theorem), for n > 1, a(n) < n. - _Zak Seidov_, Dec 27 2018 %H A013632 Vincenzo Librandi, <a href="/A013632/b013632.txt">Table of n, a(n) for n = 0..5000</a> %H A013632 Brăduţ Apostol, Laurenţiu Panaitopol, Lucian Petrescu, and László Tóth, <a href="http://arxiv.org/abs/1503.01086">Some properties of a sequence defined with the aid of prime numbers</a>, arXiv:1503.01086 [math.NT], 2015. %H A013632 Brăduţ Apostol, Laurenţiu Panaitopol, Lucian Petrescu, and László Tóth, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Toth/toth21.html">Some Properties of a Sequence Defined with the Aid of Prime Numbers</a>, J. Int. Seq. 18 (2015) # 15.5.5. %F A013632 a(n) = Prime(1 + PrimePi(n)) - n = A084695(n, 1) (for n > 0). - _G. C. Greubel_, May 12 2023 %e A013632 a(30) = 1 because 31 is the next prime greater than 30 and 31 - 30 = 1. %e A013632 a(31) = 6 because 37 is the next prime greater than 31 and 37 - 31 = 6. %p A013632 [ seq(nextprime(i)-i,i=0..100) ]; %t A013632 Array[NextPrime[#] - # &, 105, 0] (* _Robert G. Wilson v_, Nov 05 2010 *) %o A013632 (PARI) a(n) = nextprime(n+1) - n; \\ _Michel Marcus_, Mar 04 2015 %o A013632 (Magma) [NextPrime(n) - n: n in [0..100]]; // _Vincenzo Librandi_, Dec 27 2018 %o A013632 (SageMath) [next_prime(n) - n for n in range(121)] # _G. C. Greubel_, May 12 2023 %Y A013632 Cf. A007918, A007920, A084695, A151800. %K A013632 nonn,easy %O A013632 0,1 %A A013632 _N. J. A. Sloane_ %E A013632 Incorrect comment removed by _Charles R Greathouse IV_, Mar 18 2010 %E A013632 More terms from _Robert G. Wilson v_, Nov 05 2010