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.

Showing 1-2 of 2 results.

A261388 a(n) is the length of the longest stretch of consecutive primitive roots of the multiplicative group modulo prime(n).

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 3, 3, 3, 2, 3, 4, 3, 3, 4, 5, 5, 2, 3, 3, 3, 3, 7, 6, 5, 4, 5, 6, 4, 3, 4, 4, 5, 4, 6, 4, 4, 4, 6, 5, 6, 3, 5, 4, 5, 3, 4, 5, 7, 4, 7, 6, 4, 5, 6, 7, 9, 4, 4, 4, 9, 5, 4, 5, 4, 6, 4, 3, 8, 6, 7, 8, 5, 5, 4, 8, 5, 3, 5, 7, 8, 6, 6, 4, 4, 6, 9, 5, 4, 4, 11, 11, 5, 5, 5, 8, 7, 5, 6
Offset: 1

Views

Author

Joerg Arndt, Aug 17 2015

Keywords

Crossrefs

Cf. A261438 (primes corresponding to records).

Programs

  • Mathematica
    a[n_] := 1 + Max[ Join[{0}, Length/@ Select[ Split@ Differences @ PrimitiveRootList @ Prime @ n, #[[1]] == 1 &]]]; Array[a, 99] (* Giovanni Resta, Aug 17 2015 *)
  • PARI
    consec_pr(p)= \\ max number of consecutive primroots
    {
        my( v = vector(p-1) );
        my (g = znprimroot(p) );
        for (j=1, p-1,  if (gcd(p-1,j)==1, v[lift(g^j)]=1 ) );
        my ( m=0, t=0 );
        for (j=1, p-1, if ( v[j]==0, t=0 , t+=1; if ( t>m, m=t ); ); );
        return(m);
    }
    forprime(p=2,10^3, c=consec_pr(p);  print1( c,", " ); );

A268397 a(n) is the smallest prime with at least n consecutive primitive roots.

Original entry on oeis.org

2, 5, 11, 37, 53, 83, 83, 269, 269, 467, 467, 1187, 1559, 1559, 1559, 6803, 6803, 6803, 10559, 10559, 10559, 35279, 38639, 38639, 38639, 38639, 38639
Offset: 1

Views

Author

Dimitri Papadopoulos, Feb 03 2016

Keywords

Examples

			a(4)=37. 37 has the primitive roots 2, 5, 13, 15, 17, 18, 19, 20, 22, 24, 32, and 35 of which 17, 18, 19, and 20 are consecutive.
		

Crossrefs

Cf. A060749, A261438 (has "exactly" instead of "at least").

Programs

  • Mathematica
    PrimRoot[n_] :=Flatten[Position[Table[MultiplicativeOrder[i, n], {i, n - 1}],n - 1]];t = {};For[targ = 1, targ <= 22, targ++,flag = 0; For[n = 1, n < 1500, n++,prs = PrimRoot[Prime[n]];numprs = EulerPhi[Prime[n] - 1]; If[targ > numprs, ,For[m = 1, m <= numprs + 1 - targ, m++,temp = Take[prs, {m, m + targ - 1}];If[temp[[1]] + targ - 1 == temp[[targ]] && flag == 0,t = Append[t, Prime[n]]; flag = 1];If[flag == 1, Break[]];]; If[flag == 1, Break[]];];If[flag == 1, Break[]];]]; t
    Join[{2},Module[{prl=Table[{p,Max[Length/@Select[Split[ Differences[ PrimitiveRootList[ p]]], #[[1]]==1&]]},{p,Prime[Range[1500]]}]},Table[ SelectFirst[ prl, #[[2]]>=k&],{k,20}]][[All, 1]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 23 2019 *)

Extensions

More terms from Harvey P. Dale, Aug 23 2019
Showing 1-2 of 2 results.