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.

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

This page as a plain text file.
%I A081888 #23 Jun 19 2023 12:40:22
%S A081888 1,3,4,6,22,118,191,362,842,2042,2342,3622,16022,29642,66602,110881,
%T A081888 143522,535802,5070662,6252122,6497402,10219442,69069002,1130187962
%N A081888 Numbers n such that the least positive primitive root of n is larger than the value for all positive numbers smaller than n.
%C A081888 A081889 gives the primitive roots itself. Difference from A002229, A002230: In consideration of all n having primitive roots. A002229, A002230 only primes.
%F A081888 Numbers 1, 2, 4, p^m and 2*p^m have primitive roots for odd primes p and m >=1 natural number.
%p A081888 a306252 := proc(n::integer)
%p A081888     local r;
%p A081888     r := numtheory[primroot](n) ;
%p A081888     if r <> FAIL then
%p A081888         return r ;
%p A081888     else
%p A081888         return -1 ;
%p A081888     end if;
%p A081888 end proc:
%p A081888 A081888 := proc()
%p A081888     local rec,n,lpr ;
%p A081888     rec := -1 ;
%p A081888     for n from 1 do
%p A081888         lpr := a306252(n) ;
%p A081888         if lpr > rec then
%p A081888             printf("%d,\n",n) ;
%p A081888             rec := lpr ;
%p A081888         end if;
%p A081888     end do:
%p A081888 end proc:
%p A081888 A081888() ; # _R. J. Mathar_, Apr 04 2019
%t A081888 nmax = 10^5;
%t A081888 r[n_] := r[n] = Module[{prl = PrimitiveRootList[n]}, If[prl == {}, -1, prl[[1]]]]; r[1] = 1;
%t A081888 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 A081888 (Python)
%o A081888 from sympy import primitive_root
%o A081888 from itertools import count, islice
%o A081888 def f(n): r = primitive_root(n); return r if r != None else 0
%o A081888 def agen(r=0): yield from ((m, r:=f(m))[0] for m in count(1) if f(m) > r)
%o A081888 print(list(islice(agen(), 18))) # _Michael S. Branicky_, Feb 13 2023
%Y A081888 Cf. A081889, A002229, A002230. Positions of records of A306252.
%K A081888 nonn,more
%O A081888 1,2
%A A081888 _Sven Simon_, Mar 30 2003
%E A081888 a(24) from _Michael S. Branicky_, Feb 20 2023