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.

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

This page as a plain text file.
%I A261388 #13 Aug 18 2015 13:19:21
%S A261388 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,
%T A261388 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,
%U A261388 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
%N A261388 a(n) is the length of the longest stretch of consecutive primitive roots of the multiplicative group modulo prime(n).
%H A261388 Joerg Arndt, <a href="/A261388/b261388.txt">Table of n, a(n) for n = 1..9592</a> (terms for all primes < 10^5)
%t A261388 a[n_] := 1 + Max[ Join[{0}, Length/@ Select[ Split@ Differences @ PrimitiveRootList @ Prime @ n, #[[1]] == 1 &]]]; Array[a, 99] (* _Giovanni Resta_, Aug 17 2015 *)
%o A261388 (PARI)
%o A261388 consec_pr(p)= \\ max number of consecutive primroots
%o A261388 {
%o A261388     my( v = vector(p-1) );
%o A261388     my (g = znprimroot(p) );
%o A261388     for (j=1, p-1,  if (gcd(p-1,j)==1, v[lift(g^j)]=1 ) );
%o A261388     my ( m=0, t=0 );
%o A261388     for (j=1, p-1, if ( v[j]==0, t=0 , t+=1; if ( t>m, m=t ); ); );
%o A261388     return(m);
%o A261388 }
%o A261388 forprime(p=2,10^3, c=consec_pr(p);  print1( c,", " ); );
%Y A261388 Cf. A261438 (primes corresponding to records).
%K A261388 nonn
%O A261388 1,3
%A A261388 _Joerg Arndt_, Aug 17 2015