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-3 of 3 results.

A377939 Nonsquares k such that A377938(k) is not a prime.

Original entry on oeis.org

3, 5, 7, 17, 19, 22, 23, 29, 31, 33, 37, 43, 47, 53, 55, 71, 85, 87, 89, 91, 102, 103, 105, 106, 109, 111, 112, 113, 115, 116, 117, 122, 123, 133, 139, 141, 143, 145, 149, 153, 155, 157, 162, 163, 167, 175, 177, 191, 193, 199, 201, 203, 209, 211, 221, 223, 233, 239, 241, 243, 245, 247, 249, 253
Offset: 1

Views

Author

Robert Israel, Nov 11 2024

Keywords

Comments

Numbers k such that k is a primitive root modulo some nonprime x > k but not modulo any prime between k and x.
Numbers k such that 0 < A377938(k) < A023049(k).

Examples

			a(3) = 7 is a term because 7 is a primitive root mod 10, while the least prime > 7 for which 7 is a primitive root is 11.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local k;
      if issqr(n) then return false fi;
      for k from n+1 do
        if igcd(k,n) = 1 and numtheory:-order(n,k) = numtheory:-phi(k) then return not isprime(k) fi
      od
    end proc:
    select(filter, [$2..1000]);

A023049 Smallest prime > n having primitive root n, or 0 if no such prime exists.

Original entry on oeis.org

2, 3, 5, 0, 7, 11, 11, 11, 0, 17, 13, 17, 19, 17, 19, 0, 23, 29, 23, 23, 23, 31, 47, 31, 0, 29, 29, 41, 41, 41, 47, 37, 43, 41, 37, 0, 59, 47, 47, 47, 47, 59, 47, 47, 47, 67, 59, 53, 0, 53, 53, 59, 71, 59, 59, 59, 67, 73, 61, 73, 67, 71, 67, 0, 71, 79, 71, 71, 71, 79, 83, 83, 83, 79
Offset: 1

Views

Author

Keywords

Comments

Indices of record values of a(n)-n are (1, 2, 3, 6, 10, 18, 23, 78, 102, 105, 488, 652, 925, ...). Record values of a(n)/n are 3/2, 5/3, 11/6, 47/23, ... (Is there another n with a(n) > 2n ?) - M. F. Hasler, Feb 21 2017

Crossrefs

See also A056619, where the primitive root may be larger than the prime, whereas in A023049 it may not be.

Programs

  • Maple
    f:= proc(n) local p;
      if issqr(n) then return 0 fi;
      p:= nextprime(n);
      do
        if numtheory:-order(n,p) = p-1 then return p fi;
        p:= nextprime(p);
      od
    end proc:
    f(1):= 2:
    map(f, [$1..100]); # Robert Israel, Feb 21 2017
  • Mathematica
    a[n_] := For[p = 2, p <= 2 n + 1, p = NextPrime[p], If[MemberQ[ PrimitiveRootList[p], n], Return[p]]] /. Null -> 0; Array[a, 100] (* Jean-François Alcover, Mar 05 2019 *)
  • PARI
    A023049(n)={issquare(n)||forprime(p=n+1,,znorder(Mod(n,p))==p-1&&return(p));(n==1)*2} \\ M. F. Hasler, Feb 21 2017

Formula

a(n) = 0 iff n is a square > 1. - M. F. Hasler, Feb 21 2017

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]);
Showing 1-3 of 3 results.