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.

Previous Showing 11-13 of 13 results.

A307550 Irregular array of distinct terms read by rows: for n > 0, row n = [r(1),...,r(k)] with r(1) = n^2 (mod prime(n)), r(2) = r(1)^2 (mod prime(n)), ..., r(k) = r(k-1)^2 (mod prime(n)), where r(k) is the last term of the cycle.

Original entry on oeis.org

1, 1, 4, 1, 2, 4, 3, 9, 4, 5, 10, 9, 3, 15, 4, 16, 1, 7, 11, 12, 6, 13, 8, 18, 2, 4, 16, 3, 9, 13, 24, 25, 16, 28, 9, 19, 20, 33, 16, 34, 9, 7, 12, 5, 25, 10, 18, 37, 16, 24, 17, 31, 15, 10, 14, 37, 6, 36, 27, 24, 12, 3, 9, 34, 28, 32, 44, 28, 42, 15, 13, 10
Offset: 1

Views

Author

Michel Lagneau, Apr 14 2019

Keywords

Comments

Consider the map of quadratic residues x -> x^2 (mod prime(n)) with the initial term x = r(1) = n^2 (mod prime(n)) needed to reach the end of the cycle. Row n contains all distinct quadratic residues r(i) such that r(i) = r(j)^2 (mod prime(n)) for some i, j.
The corresponding row lengths are given by the sequence {b(n)} = {1, 1, 2, 2, 4, 3, 4, 2, 10, 4, 4, 6, 6, 6, 11, 12, 28, 5, 10, 3, 4, 12, 20, 12, 5, 21, ...} with b(n) = A307551(n) + 1. We observe the following property: if prime(n) = 2p + 1 with p prime, b(n) = p - 1 if 2 is a primitive root mod p; that is, p is in A001122 (see A141305). Example: b(17) = 28 because prime(17) = 59 = 2*29 + 1 with 28 = 29 - 1, and 2 is a primitive root mod 29.

Examples

			Row 5 = [3, 9, 4, 5] because prime(5) = 11, and 3 = 5^2 (mod 11), 9 = 3^2 (mod 11), 4 = 9^2 (mod 11) and 5 = 4^2 (mod 11).
Irregular array starts:
  [1];
  [1];
  [4, 1];
  [2, 4];
  [3, 9, 4, 5];
  [10, 9, 3];
  [15, 4, 16, 1];
   ...
		

Crossrefs

Programs

  • Maple
    nn:=30:T:=array(1..280):j:=0 :
    for n from 1 to nn do:
    p:=ithprime(n):lst0:={}:lst1:={}:ii:=0:r:=n:
    for k from 1 to 10^6 while(ii=0) do:
      r1:=irem(r^2,p):lst0:=lst0 union {r1}:j:=j+1:T[j]:=r1:
          if lst0=lst1
           then
            ii:=1:
            else
            r:=r1:lst1:=lst0:
          fi:
         od:
       if lst0 intersect {r1} = {r1}
        then
        j:=j-1:else fi:
    od:
    print(T):
  • Mathematica
    s[n_] := Module[{p = Prime[n]}, f[x_] := Mod[x^2, p]; Most[NestWhileList[f, f[n], Unequal, All]]]; seq = {}; Do[AppendTo[seq, s[n]], {n, 20}]; seq // Flatten (* Amiram Eldar, Jul 05 2019 *)

A307551 Number of iterations of the map of quadratic residues x -> x^2 (mod prime(n)) with the initial term x = n^2 (mod prime(n)) needed to reach the end of the cycle.

Original entry on oeis.org

0, 0, 1, 1, 3, 2, 3, 1, 9, 3, 3, 5, 5, 5, 10, 11, 27, 4, 9, 2, 3, 11, 19, 11, 4, 20, 7, 51, 17, 2, 5, 11, 9, 10, 35, 19, 11, 5, 81, 13, 10, 3, 35, 6, 21, 29, 11, 35, 27, 18, 27, 7, 5, 99, 7, 129, 65, 35, 10, 2, 22, 9, 23, 19, 13, 38, 19, 8, 171, 27, 13, 177, 59
Offset: 1

Views

Author

Michel Lagneau, Apr 14 2019

Keywords

Comments

Let L(n) be the number of elements in row n of A307550. Then a(n) = L(n) - 1.

Examples

			a(5) = 3 because prime(5) = 11, and 5^2 (mod 11) = 3 -> 3^2 (mod 11) = 9 ->  9^2 (mod 11) = 4 -> 4^2 (mod 11) = 5 with 3 iterations, where 5 is the last term of the cycle.
		

Crossrefs

Programs

  • Maple
    nn:=100:T:=array(1..3000):j:=0 :
    for n from 1 to nn do:
    p:=ithprime(n):lst0:={}:lst1:={}:ii:=0:r:=n:
    for k from 1 to 10^6 while(ii=0) do:
      r1:=irem(r^2,p):lst0:=lst0 union {r1}:j:=j+1:T[j]:=r1:
          if lst0=lst1
           then
            ii:=1: printf(`%d, `,nops(lst0)-1):
            else
            r:=r1:lst1:=lst0:
          fi:
         od:
       if lst0 intersect {r1} = {r1}
        then
        j:=j-1:else fi:
    od:
  • Mathematica
    a[n_] := Module[{p = Prime[n]}, f[x_] := Mod[x^2, p]; Length[NestWhileList[f, f[n], Unequal, All]] - 2]; Array[a, 100] (* Amiram Eldar, Jul 05 2019 *)

A309680 The smallest nonsquare nonzero integer that is a quadratic residue modulo n, or 0 if no such integer exists.

Original entry on oeis.org

0, 0, 0, 0, 0, 3, 2, 0, 7, 5, 3, 0, 3, 2, 6, 0, 2, 7, 5, 5, 7, 3, 2, 12, 6, 3, 7, 8, 5, 6, 2, 17, 3, 2, 11, 13, 3, 5, 3, 20, 2, 7, 6, 5, 10, 2, 2, 33, 2, 6, 13, 12, 6, 7, 5, 8, 6, 5, 3, 21, 3, 2, 7, 17, 10, 3, 6, 8, 3, 11, 2, 28, 2, 3, 6, 5, 11, 3, 2, 20, 7
Offset: 1

Views

Author

John Prosser, Aug 12 2019

Keywords

Examples

			For n=5, the nonzero quadratic residues modulo 5 are 1 and 4. Since these are both squares we have a(5) = 0.
For n=6, the nonzero quadratic residues modulo 6 are 1,3, and 4. Since 3 is not a square we have a(6) = 3.
For n=10, the nonzero quadratic residues modulo 10 are 1,4,5,6,9. Since 5 is the least nonsquare value, we have a(10) = 5.
		

Crossrefs

A330404 is an alternate version.

Programs

  • Mathematica
    a[n_] := SelectFirst[ Union@ Mod[Range[n-1]^2, n], ! IntegerQ@ Sqrt@ # &, 0]; Array[a, 81] (* Giovanni Resta, Aug 13 2019 *)
  • PARI
    a(n) = my(v=select(x->issquare(x), vector(n-1, k, Mod(k,n)), 1), y = select(x->!issquare(x), Vec(v))); if (#y, y[1], 0); \\ Michel Marcus, Aug 16 2019

Formula

a(n) = 2 for n in A057126 and n > 2. - Michel Marcus, Aug 24 2019
Previous Showing 11-13 of 13 results.