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.

A266620 a(n) = least non-divisor of n!.

This page as a plain text file.
%I A266620 #31 Feb 22 2023 21:19:43
%S A266620 2,3,4,5,7,7,11,11,11,11,13,13,17,17,17,17,19,19,23,23,23,23,29,29,29,
%T A266620 29,29,29,31,31,37,37,37,37,37,37,41,41,41,41,43,43,47,47,47,47,53,53,
%U A266620 53,53,53,53,59,59,59,59,59,59,61,61,67,67,67,67,67,67,71
%N A266620 a(n) = least non-divisor of n!.
%C A266620 It appears that a(n) = A151800(n) with the exception of n = 3. - _Robert Israel_, Jan 13 2016
%H A266620 Robert Israel, <a href="/A266620/b266620.txt">Table of n, a(n) for n = 1..10000</a>
%F A266620 a(n) = min_{k >= 1} prime(k)^(1 + v(n!, prime(k))) where v(m, p) is the p-adic order of m. - _Robert Israel_, Jan 13 2016
%F A266620 a(n) = prime(pi(n) + 1) except for n = 3, in which case the least non-divisor of 3! is 4, not 5. - _Alonso del Arte_, Sep 23 2017
%e A266620 For n = 4 the least non-divisor of 4! = 24 = 2^3 * 3 is 5.
%e A266620 For n = 5 the least non-divisor of 5! = 120 = 2^3 * 3 * 5 is 7.
%p A266620 N:= 100: # to get a(1)..a(N)
%p A266620 m:= 1 + numtheory:-pi(N):
%p A266620 Primes:= [seq(ithprime(i),i=1..m)]:
%p A266620 for i from 1 to m do pindex[Primes[i]]:= i od:
%p A266620 V:= Vector(m):
%p A266620 k:= 0:
%p A266620 for n from 1 to N do
%p A266620   for f in ifactors(n)[2] do
%p A266620     q:= pindex[f[1]];
%p A266620     V[q]:= V[q] + f[2];
%p A266620     k:= max(k, q);
%p A266620   od:
%p A266620   a[n]:= min(seq(Primes[i]^(1+V[i]),i=1..k),Primes[k+1]);
%p A266620 od:
%p A266620 seq(a[n],n=1..N); # _Robert Israel_, Jan 13 2016
%t A266620 Table[Complement[Range[2n], Divisors[n!]][[1]], {n, 30}] (* _Alonso del Arte_, Sep 23 2017 *)
%t A266620 Table[Block[{m = n!, k = n + 1}, While[Divisible[m, k], k++]; k], {n, 67}] (* _Michael De Vlieger_, Sep 23 2017 *)
%o A266620 (Python)
%o A266620 from sympy import nextprime
%o A266620 def A266620(n): return 4 if n == 3 else nextprime(n) # _Chai Wah Wu_, Feb 22 2023
%Y A266620 Cf. A007918, A007978, A066169, A115627, A151800.
%K A266620 nonn,easy
%O A266620 1,1
%A A266620 _Jeffrey Shallit_, Jan 01 2016