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.

A360825 a(n) is the remainder after dividing n! by its least nondivisor.

Original entry on oeis.org

1, 1, 2, 2, 4, 1, 6, 2, 5, 1, 10, 1, 12, 3, 8, 1, 16, 1, 18, 4, 11, 1, 22, 22, 6, 5, 14, 1, 28, 1, 30, 33, 20, 31, 18, 1, 36, 7, 20, 1, 40, 1, 42, 8, 23, 1, 46, 19, 11, 9, 26, 1, 52, 30, 27, 10, 29, 1, 58, 1, 60, 43, 53, 56, 33, 1, 66, 12, 35, 1, 70, 1, 72, 27, 23
Offset: 0

Views

Author

Sebastian F. Orellana, Feb 22 2023

Keywords

Comments

For every term besides a(3), the least nondivisor is the next prime after n.

Examples

			a(5) = 5! mod 7 = 120 mod 7 = 1.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{f = n!, m = n + 1}, While[Divisible[f, m], m++]; Mod[f, m]]; Array[a, 100, 0] (* Amiram Eldar, Feb 22 2023 *)
  • PARI
    a(n) = my(k=1, r); while(!(r=(n! % (n+k))), k++); r; \\ Michel Marcus, Feb 22 2023
    
  • Python
    from functools import reduce
    from sympy import nextprime
    def A360825(n):
        if n == 3: return 2
        m = nextprime(n)
        return reduce(lambda i, j: i*j%m,range(2,n+1),1)%m # Chai Wah Wu, Feb 22 2023
    
  • Python
    from functools import reduce
    from sympy import nextprime
    def A360825(n):
        if n == 3: return 2
        m = nextprime(n)
        return (m-1)*pow(reduce(lambda i,j:i*j%m,range(n+1,m),1),-1,m)%m # Chai Wah Wu, Feb 23 2023

Formula

a(n) = 1 <=> n in { A040976 } \ { 3 }.
a(n) = n <=> n in { A006093 }.
a(n) = n! mod A151800(n) for n > 3.
a(n) = A213636(n!) = A213636(A000142(n)).
a(A000040(n)) = A275111(n) for n >= 3.
a(n) > n <=> n in { A360805 }.