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.

This page as a plain text file.
%I A360825 #58 Feb 24 2023 18:51:48
%S A360825 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,
%T A360825 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,
%U A360825 10,29,1,58,1,60,43,53,56,33,1,66,12,35,1,70,1,72,27,23
%N A360825 a(n) is the remainder after dividing n! by its least nondivisor.
%C A360825 For every term besides a(3), the least nondivisor is the next prime after n.
%H A360825 Alois P. Heinz, <a href="/A360825/b360825.txt">Table of n, a(n) for n = 0..10000</a>
%F A360825 a(n) = 1 <=> n in { A040976 } \ { 3 }.
%F A360825 a(n) = n <=> n in { A006093 }.
%F A360825 a(n) = n! mod A151800(n) for n > 3.
%F A360825 a(n) = A213636(n!) = A213636(A000142(n)).
%F A360825 a(A000040(n)) = A275111(n) for n >= 3.
%F A360825 a(n) > n <=> n in { A360805 }.
%e A360825 a(5) = 5! mod 7 = 120 mod 7 = 1.
%t A360825 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 *)
%o A360825 (PARI) a(n) = my(k=1, r); while(!(r=(n! % (n+k))), k++); r; \\ _Michel Marcus_, Feb 22 2023
%o A360825 (Python)
%o A360825 from functools import reduce
%o A360825 from sympy import nextprime
%o A360825 def A360825(n):
%o A360825     if n == 3: return 2
%o A360825     m = nextprime(n)
%o A360825     return reduce(lambda i, j: i*j%m,range(2,n+1),1)%m # _Chai Wah Wu_, Feb 22 2023
%o A360825 (Python)
%o A360825 from functools import reduce
%o A360825 from sympy import nextprime
%o A360825 def A360825(n):
%o A360825     if n == 3: return 2
%o A360825     m = nextprime(n)
%o A360825     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
%Y A360825 Cf. A000040, A000142, A006093, A040976, A151800, A213636, A275111, A360805.
%K A360825 nonn
%O A360825 0,3
%A A360825 _Sebastian F. Orellana_, Feb 22 2023