login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007978 Least non-divisor of n. 33

%I #54 Feb 22 2023 18:12:20

%S 2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,

%T 2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,7,2,3,2,3,2,4,2,3,

%U 2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3,2,4,2,3,2,3,2,5,2,3,2,3

%N Least non-divisor of n.

%C Least k >= 2 such that sigma(n) divides sigma(n*k), where sigma is A000203. - _Benoit Cloitre_, Dec 01 2002

%C Contains all and only the prime powers p^k, k > 0. The first occurrence of p^k is at A003418(p^k-1); so new records occur at indices in A051451. - _Franklin T. Adams-Watters_, Jun 13 2011

%H Reinhard Zumkeller, <a href="/A007978/b007978.txt">Table of n, a(n) for n = 1..10000</a>

%H Bakir Farhi, <a href="https://www.emis.de/journals/INTEGERS/papers/j42/j42.Abstract.html">On the average asymptotic behavior of a certain type of sequences of integers</a>, Integers, Vol. 9 (2009), pp. 555-567.

%F a(n) = A053669(n) + A061853(n) = A055874(n) + 1. - _Henry Bottomley_, May 10 2001

%F G.f.: sum(k >= 2, -k*(x^A003418(k) - x^A003418(k-1))/((x^A003418(k) - 1)*(x^A003418(k-1) - 1))). - _Robert Israel_, Sep 02 2014

%F From _Alonso del Arte_, Sep 23 2017: (Start)

%F a(n) < n for all n > 2.

%F a(2n + 1) = 2, a(2n) >= 3.

%F a(2^k) = 3 for k > 0.

%F a(n!) = prime(pi(n) + 1) for n >= 0, except for a(3!) = 4. (End)

%F Asymptotic mean: lim_{n->oo} Sum_{k=1..n} a(k) = 1 + A064859 (Farhi, 2009). - _Amiram Eldar_, Jun 29 2021

%p a:= proc(n) local k;

%p for k from 2 while n mod k = 0 do od:

%p k

%p end proc:

%p seq(a(n),n=1..100); # _Robert Israel_, Sep 02 2014

%t Table[k := 1; While[Mod[n, k] == 0, k++]; k, {n, 2000}] (* _Clark Kimberling_, Jun 16 2012 *)

%t Join[{2, 3}, Table[Complement[Range[n], Divisors[n]][[1]], {n, 3, 100}]] (* _Alonso del Arte_, Sep 23 2017 *)

%o (Haskell)

%o import Data.List ((\\))

%o a007978 = head . ([1..] \\) . a027750_row

%o -- _Reinhard Zumkeller_, May 10 2014

%o (PARI) a(n) = {my(k=2); while(!(n % k), k++); k;} \\ _Michel Marcus_, Sep 25 2017

%o (Python)

%o def a(n):

%o k = 2

%o while not n%k: k += 1

%o return k

%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 09 2022

%o (Python)

%o def A007978(n): return next(filter(lambda d:n%d,range(2,n))) if n>2 else n+1 # _Chai Wah Wu_, Feb 22 2023

%Y Cf. A003418, A051451, A055874, A053669, A061853, A027750, A064859.

%Y Cf. also A266620 (least non-divisor of n!).

%K nonn

%O 1,1

%A _Jeffrey Shallit_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 02:14 EDT 2024. Contains 371906 sequences. (Running on oeis4.)