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!)
A081888 Numbers n such that the least positive primitive root of n is larger than the value for all positive numbers smaller than n. 3

%I #23 Jun 19 2023 12:40:22

%S 1,3,4,6,22,118,191,362,842,2042,2342,3622,16022,29642,66602,110881,

%T 143522,535802,5070662,6252122,6497402,10219442,69069002,1130187962

%N Numbers n such that the least positive primitive root of n is larger than the value for all positive numbers smaller than n.

%C A081889 gives the primitive roots itself. Difference from A002229, A002230: In consideration of all n having primitive roots. A002229, A002230 only primes.

%F Numbers 1, 2, 4, p^m and 2*p^m have primitive roots for odd primes p and m >=1 natural number.

%p a306252 := proc(n::integer)

%p local r;

%p r := numtheory[primroot](n) ;

%p if r <> FAIL then

%p return r ;

%p else

%p return -1 ;

%p end if;

%p end proc:

%p A081888 := proc()

%p local rec,n,lpr ;

%p rec := -1 ;

%p for n from 1 do

%p lpr := a306252(n) ;

%p if lpr > rec then

%p printf("%d,\n",n) ;

%p rec := lpr ;

%p end if;

%p end do:

%p end proc:

%p A081888() ; # _R. J. Mathar_, Apr 04 2019

%t nmax = 10^5;

%t r[n_] := r[n] = Module[{prl = PrimitiveRootList[n]}, If[prl == {}, -1, prl[[1]]]]; r[1] = 1;

%t Reap[Module[{rec = -1, n, lpr}, For[n = 1, n <= nmax, n++, lpr = r[n]; If[lpr > rec, Print[n, " ", lpr]; Sow[n]; rec = lpr]]]][[2, 1]] (* _Jean-François Alcover_, Jun 19 2023, after _R. J. Mathar_ *)

%o (Python)

%o from sympy import primitive_root

%o from itertools import count, islice

%o def f(n): r = primitive_root(n); return r if r != None else 0

%o def agen(r=0): yield from ((m, r:=f(m))[0] for m in count(1) if f(m) > r)

%o print(list(islice(agen(), 18))) # _Michael S. Branicky_, Feb 13 2023

%Y Cf. A081889, A002229, A002230. Positions of records of A306252.

%K nonn,more

%O 1,2

%A _Sven Simon_, Mar 30 2003

%E a(24) from _Michael S. Branicky_, Feb 20 2023

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 July 30 19:14 EDT 2024. Contains 374771 sequences. (Running on oeis4.)