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.

A377940 a(n) is the least number k such that the least j > k for which k is a primitive root is also the least j > n + k for which n + k is a primitive root, or -1 if there is no such k.

Original entry on oeis.org

20, 6, 32, 10, 39, 28, 38, 18, 18, 42, 46, 42, 88, 42, 46, 173, 46, 78, 229, 102, 102, 294, 78, 150, 210, 150, 210, 193, 232, 193, 848, 488, 330, 226, 226, 328, 488, 328, 294, 172, 172, 294, 294, 294, 462, 328, 736, 328, 328, 294, 1098, 328, 328, 1196, 172, 172, 1322, 172, 1196, 856, 1108, 889
Offset: 1

Views

Author

Robert Israel, Nov 11 2024

Keywords

Comments

a(n) is the least k, if it exists, such that 0 < A377938(k) = A377938(k+n).

Examples

			a(3) = 32 because A377938(32) = A377938(35) = 37, i.e. 37 is the least number j > 32 such that 32 is a primitive root mod j and the least number j > 35 such that 35 is a primitive root mod j, and no number less than 32 works.
		

Crossrefs

Cf. A377938.

Programs

  • Maple
    N:= 10^6:
    P:= select(isprime, {seq(i,i=3..N,2)}):Cands:= map(proc(t) local i; (seq(t^i,i=1..ilog[t](N)), seq(2*t^i,i=1..ilog[t](N/2))) end proc,P):
    Cands:= sort(convert({4} union Cands, list)):
    nC:= nops(Cands):
    Phis:= map(numtheory:-phi, Cands):
    f:= proc(n)
    option remember;
    local k0,k;
          if issqr(n) then return -1 fi;
          k0:= ListTools:-BinaryPlace(Cands,n)+1;
          for k from k0 to nC do
            if igcd(Cands[k],n) = 1 and numtheory:-order(n,Cands[k]) = Phis[k] then return Cands[k] fi
          od;
        FAIL
    end proc:
    g:= proc(n)
      local k;
      for k from n+1 do
        if f(k) > 0 and f(k) = f(k+n) then return k
      elif f(k) = FAIL and f(k+n) = FAIL then return FAIL fi
      od
    end proc:
    map(g, [$1..200]);