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.

A262932 Numbers k such that 7 is a square mod k.

Original entry on oeis.org

1, 2, 3, 6, 7, 9, 14, 18, 19, 21, 27, 29, 31, 37, 38, 42, 47, 53, 54, 57, 58, 59, 62, 63, 74, 81, 83, 87, 93, 94, 103, 106, 109, 111, 113, 114, 118, 126, 131, 133, 137, 139, 141, 149, 159, 162, 166, 167, 171, 174, 177, 186, 189, 193, 197, 199, 203, 206, 217, 218, 222
Offset: 1

Views

Author

Erik Pelttari, Oct 04 2015

Keywords

Examples

			7^2 == 7 (mod 14), so 14 is a term.
5^2 == 7 (mod 18) and 13^2 == 7 (mod 18), so 18 is a term.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..300] | exists(t){x : x in ResidueClassRing(n) | x^2 eq 7}]; // Vincenzo Librandi, Oct 05 2015
  • Maple
    with(numtheory):
    a:= proc(n) option remember; local k;
          for k from 1+`if`(n=1, 0, a(n-1))
          while mroot(7, 2, k)=FAIL do od; k
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Feb 24 2017
  • Mathematica
    Join[{1}, Table[If[Reduce[x^2 == 7, Modulus->n] === False, Null, n], {n, 2, 300}]//Union] (* Vincenzo Librandi, Oct 05 2015 *)
  • PARI
    for(n=1, 300, if (issquare(Mod(7, n)), print1(n", "))); \\ Altug Alkan, Oct 04 2015
    

A381884 Triangle read by rows: T(n, k) = 0 if n = 0 or k is not a quadratic residue modulo n, otherwise T(n, k) = k.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Mar 17 2025

Keywords

Examples

			Triangle T(n, k) starts:
  [0] 0;
  [1] 0, 1;
  [2] 0, 1, 2;
  [3] 0, 1, 0, 3;
  [4] 0, 1, 0, 0, 4;
  [5] 0, 1, 0, 0, 4, 5;
  [6] 0, 1, 0, 3, 4, 0, 6;
  [7] 0, 1, 2, 0, 4, 0, 0, 7;
  [8] 0, 1, 0, 0, 4, 0, 0, 0, 8;
  [9] 0, 1, 0, 0, 4, 0, 0, 7, 0, 9;
.
Array Arow(n) = [T(j, n), j = 0.. ] starts:
  [0] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
  [1] 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  [2] 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, ...
  [3] 0, 3, 3, 3, 0, 0, 3, 0, 0, 0, ...
  [4] 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...
  [5] 0, 5, 5, 0, 5, 5, 0, 0, 0, 0, ...
  [6] 0, 6, 6, 6, 0, 6, 6, 0, 0, 0, ...
  [7] 0, 7, 7, 7, 0, 0, 7, 7, 0, 7, ...
  [8] 0, 8, 8, 0, 8, 0, 0, 8, 8, 0, ...
  [9] 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, ...
.
3 is not a quadratic residue modulo 7, therefore T(7, 3) = 0.
12 is a quadratic residue modulo 23, therefore T(23, 12) = 12.
		

Crossrefs

Indices of the nonzero terms in row n of the array: A057126 (row 2), A057125 (row 3), A057762 (row 5), A262931 (row 6), A262932 (row 7).

Programs

  • Maple
    QR := (k, n) -> ifelse(n = 0 or NumberTheory:-QuadraticResidue(k, n) < 0, 0, 1):
    T := (n, k) -> k*QR(k, n): seq(seq(T(n, k), k = 0..n), n = 0..12);
    Arow := (n, len) -> seq(T(j, n), j=0..len): seq(lprint([n], Arow(n, 9), n=0..9);
  • Mathematica
    QR[n_, k_] := Module[{x, y}, If[Reduce[x^2 == n + k*y, {x, y}, Integers] =!= False, 1, -1]];
    T[n_, k_] := If[n == 0 || QR[k, n] < 0, 0, k];
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten
  • Python
    from sympy.ntheory import is_quad_residue
    def QR(n, k): return is_quad_residue(n, k)
    def T(n, k): return 0 if n == 0 or not QR(k, n) else k
    for n in range(13): print([T(n, k) for k in range(n + 1)])
Showing 1-2 of 2 results.