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.

A301427 Least nonnegative integer k such that n! - n - k is prime.

Original entry on oeis.org

0, 1, 2, 5, 10, 23, 4, 1, 2, 1, 10, 3, 32, 37, 42, 23, 82, 11, 10, 51, 66, 49, 124, 11, 16, 73, 2, 49, 30, 131, 14, 159, 78, 91, 60, 41, 34, 43, 90, 37, 66, 65, 8, 43, 32, 55, 10, 47, 128, 15, 6, 73, 6, 405, 220, 51, 78, 79, 10, 9, 38, 295, 62, 251, 124, 183, 34, 27, 680, 91, 300
Offset: 3

Views

Author

Seiichi Manyama, Mar 21 2018

Keywords

Comments

The (n-1) consecutive numbers n!-n, ... , n!-2 (for n > 3) are not prime.

Examples

			a(3)=0 because 3! - 3 - 0 =   3 is prime.
a(4)=1 because 4! - 4 - 1 =  19 is prime and 20 is not.
a(5)=2 because 5! - 5 - 2 = 113 is prime and 114 and 115 are not prime.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local r; r:= n!-n;
      r - prevprime(r)
    end proc:
    f(3):= 0:
    seq(f(i),i=3..100); # Robert Israel, Mar 23 2018
  • Mathematica
    a[n_] := n! - NextPrime[n! - 1, -1] - n;
    a /@ Range[3, 100] (* Jean-François Alcover, Oct 26 2020 *)
  • PARI
    a(n) = apply(x->(x-precprime(x)), n!-n);
    vector(99, n, a(n+2)) \\ Altug Alkan, Mar 21 2018

Formula

a(n) = A037155(n) - n.