login
Primes p that have no squareful primitive roots less than p.
1

%I #23 Sep 15 2022 06:27:56

%S 3,5,7,13,17,19,23,31,41,43,47,61,71,73,79,97,103,127,191,193,223,239,

%T 241,311,313,337,409,433,439,457,479,601,719,769,839,911,1009,1031,

%U 1033,1129,1151,1201,1249,1319,1321,1559,1801,2089,2281,2521,2689,2999,3049,3361,3529,3889

%N Primes p that have no squareful primitive roots less than p.

%H Robert Israel, <a href="/A268629/b268629.txt">Table of n, a(n) for n = 1..114</a>

%H Stephen D. Cohen and Tim Trudgian, <a href="http://arxiv.org/abs/1602.02440">On the least square-free primitive root modulo p</a>, arXiv:1602.02440 [math.NT], 2016.

%e The primitive roots of 7 less than 7 are 3 and 5. None of them are squareful so 7 is in the sequence.

%e 8 is a primitive root of 11, and 8 is squareful, so 11 is not in the sequence.

%p N:= 10^6: # for terms <= N

%p S:= {1}: p:= 1:

%p do

%p p:= nextprime(p);

%p if p^2 > N then break fi;

%p S:= S union map(t -> seq(t*p^i, i=2..floor(log[p](N/t))), select(`<=`,S,N/p^2));

%p od:

%p S:= sort(convert(S,list)):

%p nS:= nops(S):

%p filter:= proc(p) local i;

%p if not isprime(p) then return false fi;

%p for i from 1 to nS while S[i] < p do

%p if numtheory:-order(S[i],p) = p-1 then return false fi

%p od;

%p true

%p end proc:

%p select(filter, [seq(i,i=3..N,2)]); # _Robert Israel_, Oct 27 2020

%t selQ[p_] := NoneTrue[PrimitiveRootList[p], #<p && AllTrue[FactorInteger[#], #[[2]] >= 2&]&];

%t Select[Prime[Range[2, 500]], selQ] (* _Jean-François Alcover_, Sep 28 2018 *)

%o (PARI) ar(p) = my(r, pr, j); r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsort(r) ; \\ from A060749

%o isok(p) = {my(v = ar(p)); for (i=1, #v, if (ispowerful(v[i]), return(0));); 1;}

%o lista(nn) = forprime(p=1, nn, if (isok(p), print1(p, ", ")));

%o (Python)

%o from functools import cache

%o from math import gcd

%o from itertools import count, islice

%o from sympy import factorint, prime, n_order

%o @cache

%o def is_squareful(n): return n == 1 or min(factorint(n).values()) > 1

%o def A268629_gen(): # generator of terms

%o for n in count(1):

%o p = prime(n)

%o for i in range(1,p):

%o if gcd(i,p) == 1 and is_squareful(i) and n_order(i, p)==p-1:

%o break

%o else:

%o yield p

%o A268629_list = list(islice(A268629_gen(),20)) # _Chai Wah Wu_, Sep 14 2022

%Y Cf. A001694, A001918, A060749.

%K nonn

%O 1,1

%A _Michel Marcus_, Feb 09 2016