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-20 of 24 results. Next

A057760 Numbers n such that 2 is a cube mod n.

Original entry on oeis.org

1, 2, 3, 5, 6, 10, 11, 15, 17, 22, 23, 25, 29, 30, 31, 33, 34, 41, 43, 46, 47, 50, 51, 53, 55, 58, 59, 62, 66, 69, 71, 75, 82, 83, 85, 86, 87, 89, 93, 94, 101, 102, 106, 107, 109, 110, 113, 115, 118, 121, 123, 125, 127, 129, 131, 137, 138, 141, 142
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2000

Keywords

Comments

Numbers not divisible by 4 or 9 and whose prime divisors are in A040028. - Eric M. Schmidt, Jan 25 2014

Crossrefs

Programs

  • Maple
    with(numtheory); [seq(mroot(2,3,p),p=1..400)];
  • PARI
    is(n)=ispower(Mod(2,n),3) \\ Charles R Greathouse IV, Apr 05 2012

Extensions

Checked by T. D. Noe, Apr 19 2007

A324252 Triangle T(n, k) read by rows from upwards antidiagonals of array A, where A(n, k) is the number of families (also called classes) of proper solutions of the Pell equation x^2 - D(n)*y^2 = k, for k >= 1.

Original entry on oeis.org

1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 0, 2, 0, 0
Offset: 1

Views

Author

Wolfdieter Lang, Apr 20 2019

Keywords

Comments

The array A(n, k) gives the number of the representative parallel binary quadratic primitive forms for discriminant Disc(n) = 4*D(n) = 4*A000037(n) and representation of positive integer k which are (properly) equivalent to the Pell form F(n) = [1, 0, -D(n)].
For the definition of representative parallel primitive forms for discriminant Disc > 0 (the indefinte case) and representation of nonzero integers k see the Scholz-Schoeneberg reference, p. 105, or the Buell reference p. 49 (without use of the name parallel). For the procedure to find the primitive representative parallel forms (rpapfs) for Disc(n) = 4*D(n) = 4*A000037(n) and nonzero integer k see the W. Lang link given in A324251, section 3.
Among them the parallel forms which are equivalent to the reduced principal form F_p(n) = [1, 2*s(n), -(D(n) - s(n))^2], with s(n) = A000194(n), are important to find all solutions (x, y) with gcd(x, y) = 1 (proper) of the Pell form F(n) = [1, 0, -D(n)] with Disc(F(n)) = 4*D(n) > 0 representing a positive integer k. The number of these parallel forms pa(n, k) gives the number of the proper fundamental solutions. The general solution is obtained from the fundamental solutions with the help of integer powers of the automorphic matrix corresponding to the cycle determined by the reduced principal form F_p(n).
Thus the array A(n,k) gives the number of proper families (also called classes) of solutions of the Pell equation x^2 - Dn(n)*y^2 = k, for positive integer k. The positions of the nonzero entries in row n give the list of the k values for which proper solutions exist.
These position lists are A057126 (conjecture) and A243655, for k = 1 and 2.
The first column has only 1s, showing that every Pell form [1, 0, -D(n)] represents k = +1, and that there is only one family of proper solutions.

Examples

			The array A(n, k) begins:
n,  D(n) \k  1 2 3 4 5 6 7 8 9 10 11 12 13  14 15 ...
------------------------------------------------------------
1,   2:      1 1 0 0 0 0 2 0 0  0  0  0  0  2  0
2,   3:      1 0 0 0 0 1 0 0 0  0  0  0  2  0  0
3,   5:      1 0 0 2 1 0 0 0 0  0  2  0  0  0  0
4,   6:      1 0 1 0 0 0 0 0 0  2  0  0  0  0  0
5,   7:      1 1 0 0 0 0 0 0 2  0  0  0  0  0  0
6,   8:      1 0 0 0 0 0 0 1 0  0  0  0  0  0  0
7,  10:      1 0 0 0 0 2 0 0 2  1  0  0  0  0  2
8,  11:      1 0 0 0 2 0 0 0 0  0  0  0  0  2  0
9,  12:      1 0 0 1 0 0 0 0 0  0  0  0  2  0  0
10, 13:      1 0 2 2 0 0 0 0 2  0  0  4  1  0  0
11, 14:      1 1 0 0 0 0 0 0 0  0  2  0  0  0  0
12, 15:      1 0 0 0 0 0 0 0 0  1  0  0  0  0  0
13, 17:      1 0 0 0 0 0 0 2 0  0  0  0  2  0  0
14, 18:      1 0 0 0 0 0 2 0 1  0  0  0  0  0  0
15, 19:      1 0 0 0 2 2 0 0 2  0  0  0  0  0  0
16, 20:      1 0 0 0 1 0 0 0 0  0  0  0  0  0  0
17, 21:      1 0 0 2 0 0 1 0 0  0  0  0  0  0  2
18, 22:      1 0 2 0 0 0 0 0 2  0  1  0  0  2  0
19, 23:      1 1 0 0 0 0 0 0 0  0  0  0  2  0  0
20, 24:      1 0 0 0 0 0 0 0 0  0  0  1  0  0  0
...
-------------------------------------------------------------
The triangle T(n, k) begins:
n\k    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
1:     1
2:     1 1
3:     1 0 0
4:     1 0 0 0
5:     1 0 0 0 0
6:     1 1 1 2 0 0
7:     1 0 0 0 1 1 2
8:     1 0 0 0 0 0 0 0
9:     1 0 0 0 0 0 0 0 0
10:    1 0 0 0 0 0 0 0 0  0
11:    1 0 0 0 0 0 0 0 0  0  0
12:    1 1 2 1 2 2 0 0 0  0  0  0
13:    1 0 0 2 0 0 0 1 2  2  2  0  0
14:    1 0 0 0 0 0 0 0 0  0  0  0  2  2
15:    1 0 0 0 0 0 0 0 2  0  0  0  0  0  0
16:    1 0 0 0 0 0 0 0 0  1  0  0  0  0  0  0
17:    1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  2
18:    1 0 0 0 0 0 0 0 2  0  0  0  0  0  0  0  0  0
19:    1 0 0 0 2 0 0 0 0  0  0  0  0  0  0  0  0  0  0
20:    1 1 2 2 1 2 2 2 0  0  0  0  0  0  0  0  0  0  0 0
... For this triangle more of the columns of the array have been used than those that are shown.
----------------------------------------------------------------------------
A(5, 9) = 2 = T(13, 9) because D(5) = 7, and the Pell form F(5) with disc(F(5)) = 4*7 = 28 representing k = +9 has 2 families (classes) of proper solutions generated from the two positive fundamental positive solutions (x10, y10) = (11, 4) and (x20, y20) = (4, 1). They are obtained from the trivial solutions of the parallel forms [9, 8, 1] and [9, 10, 2], respectively. See the W. Lang link in A324251, section 3.
		

References

  • D. A. Buell, Binary Quadratic Forms, Springer, 1989, chapter 3, pp. 21-43.
  • A. Scholz and B. Schoeneberg, Einführung in die Zahlentheorie, 5. Aufl., de Gruyter, Berlin, New York, 1973, pp. 112-126.

Crossrefs

Formula

T(n, k) = A(n-k+1, k) for 1 <= k <= n, with A(n,k) the number of proper (positive) fundamental solutions of the Pell equation x^2 - D(n)*y^2 = k >= 1, with D(n) = A000037(n), for n >= 1.

A087780 Number of non-congruent solutions to x^2 == 2 mod n.

Original entry on oeis.org

1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0
Offset: 1

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003

Keywords

Crossrefs

Programs

  • Mathematica
    f[2, e_] := Boole[e == 1]; f[p_, e_] := If[MemberQ[{1, 7}, Mod[p, 8]], 2, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 19 2020 *)
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i,1] == 2, (f[i,2] == 1), if(f[i,1]%8 == 1 || f[i,1]%8 == 7, 2, 0)));} \\ Amiram Eldar, Nov 21 2023
  • Sage
    def A087780(n) :
        res = 1
        for (p, m) in factor(n) :
            if p % 8 in [1, 7] : res *= 2
            elif not (p==2 and m==1) : return 0
        return res
    # Eric M. Schmidt, Apr 20 2013
    

Formula

Multiplicative with a(p^m) = 2 for p == 1, 7 (mod 8); a(p^m) = 0 for p == 3, 5 (mod 8); a(2^1) = 1; a(2^m) = 0 for m > 1. - Eric M. Schmidt, Apr 20 2013
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = log(sqrt(2)+1)/(sqrt(2)*zeta(2)) = A196525/A013661 = 0.37887551404073012021... . - Amiram Eldar, Nov 21 2023

Extensions

More terms from David Wasserman, Jun 17 2005

A262931 Numbers k such that 6 is a square mod k.

Original entry on oeis.org

1, 2, 3, 5, 6, 10, 15, 19, 23, 25, 29, 30, 38, 43, 46, 47, 50, 53, 57, 58, 67, 69, 71, 73, 75, 86, 87, 94, 95, 97, 101, 106, 114, 115, 125, 129, 134, 138, 139, 141, 142, 145, 146, 149, 150, 159, 163, 167, 173, 174, 190, 191, 193, 194, 197, 201, 202, 211, 213
Offset: 1

Views

Author

Erik Pelttari, Oct 04 2015

Keywords

Examples

			6^2 == 6 (mod 15), so 15 is a term.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..300] | exists(t){x : x in ResidueClassRing(n) | x^2 eq 6}]; // 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(6, 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 == 6, Modulus->n] === False, Null, n], {n, 2, 300}]//Union] (* Vincenzo Librandi, Oct 05 2015 *)
  • PARI
    for(n=1, 300, if (issquare(Mod(6, n)), print1(n", "))); \\ Altug Alkan, Oct 04 2015
    

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
    

A307303 Triangle T(n, k) read as upwards antidiagonals of array A, where A(n, k) is the number of families (also called classes) of proper solutions of the Pell equation x^2 - D(n)*y^2 = -k, for k >= 1.

Original entry on oeis.org

1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0
Offset: 1

Views

Author

Wolfdieter Lang, Apr 20 2019

Keywords

Comments

For details see A324252 which gives the array for the numbers of families of proper solutions of x^2 - D(n)*y^2 = k for positive integers k. See also the W. Lang link in A324251, section 3.
The D(n) values for nonzero entries in column k = 1 are given in A003814 (representation of -1).
The position list for nonzero entries in row n = 1 is A057126 (conjecture).

Examples

			The array A(n, k) begins:
n,  D(n) \k  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
-------------------------------------------------------------------
1,   2:      1  1  0  0  0  0  2  0  0  0  0  0  0  2  0
2,   3:      0  1  1  0  0  0  0  0  0  0  2  0  0  0  0
3,   5:      1  0  0  2  1  0  0  0  0  0  2  0  0  0  0
4,   6:      0  1  0  0  2  1  0  0  0  0  0  0  0  0  2
5,   7:      0  0  2  0  0  2  1  0  0  0  0  0  0  1  0
6,   8:      0  0  0  1  0  0  2  1  0  0  0  0  0  0  0
7,  10:      1  0  0  0  0  2  0  0  2  1  0  0  0  0  2
8,  11:      0  1  0  0  0  0  2  0  0  2  1  0  0  0  0
9,  12:      0  0  1  0  0  0  0  2  0  0  2  1  0  0  0
10, 13:      1  0  2  2  0  0  0  0  2  0  0  4  1  0  0
11, 14:      0  0  0  0  2  0  1  0  0  2  0  0  2  1  0
12, 15:      0  0  0  0  0  1  0  0  0  0  2  0  0  2  1
13, 17:      1  0  0  0  0  0  0  2  0  0  0  0  2  0  0
14, 18:      0  1  0  0  0  0  0  0  2  0  0  0  0  2  0
15, 19:      0  1  2  0  0  0  0  0  0  2  0  0  0  0  4
16, 20:      0  0  0  1  0  0  0  0  0  0  2  0  0  0  0
17, 21:      0  0  1  0  2  0  0  0  0  0  0  2  0  0  0
18, 22:      0  1  0  0  0  0  2  0  0  0  0  0  2  0  0
19, 23:      0  0  0  0  0  0  0  0  0  0  2  0  0  2  0
20, 24:      0  0  0  0  0  0  0  1  0  0  0  0  0  0  2
-------------------------------------------------------------------
The triangle T(n, k) begins:
n\k   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 ..
1:    1
2:    0  1
3:    1  1  0
4:    0  0  1  0
5:    0  1  0  0  0
6:    0  0  0  2  0  0
7:    1  0  2  0  1  0  2
8:    0  0  0  0  2  0  0  0
9:    0  1  0  1  0  1  0  0  0
10:   1  0  0  0  0  2  0  0  0  0
11:   0  0  1  0  0  0  1  0  0  0  0
12:   0  0  2  0  0  2  2  0  0  0  2  0
13:   1  0  0  2  0  0  0  1  0  0  2  0  0
14:   0  0  0  0  0  0  2  0  0  0  0  0  0  2
15:   0  1  0  0  2  0  0  0  2  0  0  0  0  0  0
16:   0  1  0  0  0  0  0  2  0  1  0  0  0  0  0  0
17:   0  0  2  0  0  1  1  0  0  2  0  0  0  0  0  0  2
18:   0  0  0  0  0  0  0  0  2  0  1  0  0  1  2  0  0  0
19:   0  1  1  1  0  0  0  0  0  0  2  0  0  0  0  0  0  0  0
20:   0  0  0  0  0  0  0  2  0  2  0  1  0  0  0  0  0  0  0  0
...
For this triangle more than the shown columns of the array have been used.
----------------------------------------------------------------------------
A(5, 6) = 2 = T(10, 6)  because D(5) =  7, and the Pell form F(5) with disc(F(5)) = 4*7 = 28 representing k = -6 has 2 families (classes) of proper solutions generated from the two positive fundamental positive solutions (x10, y10) = (13, 5) and  (x20, y20) = (1, 1). They are obtained from the trivial solutions of the parallel forms [-6, 2, 1] and [-6, 10, -3], respectively.
		

References

  • D. A. Buell, Binary Quadratic Forms, Springer, 1989.
  • A. Scholz and B. Schoeneberg, Einführung in die Zahlentheorie, 5. Aufl., de Gruyter, Berlin, New York, 1973.

Crossrefs

Cf. A000037, A000194, A003814, A057126, A324252 (positive k), A324251.

Formula

T(n, k) = A(n-k+1, k) for 1 <= k <= n, with A(n,k) the number of proper (positive) fundamental solutions of the Pell equation x^2 - D(n)*y^2 = -k for k >= 1, with D(n) = A000037(n), for n >= 1. Each such fundamental solution generates a family of proper solutions.

A329095 Odd numbers k such that x^2 == 2 (mod k) has no solution.

Original entry on oeis.org

3, 5, 9, 11, 13, 15, 19, 21, 25, 27, 29, 33, 35, 37, 39, 43, 45, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 75, 77, 81, 83, 85, 87, 91, 93, 95, 99, 101, 105, 107, 109, 111, 115, 117, 121, 123, 125, 129, 131, 133, 135, 139, 141, 143, 145, 147, 149, 153, 155, 157, 159, 163
Offset: 1

Views

Author

Jianing Song, Nov 04 2019

Keywords

Comments

Complement of A058529 over the odd numbers: odd numbers k such that x^2 == 2 (mod k) has solutions.
Odd numbers k such that at least one prime factor of k is congruent to 3 or 5 modulo 8 (at least one prime factor is in A003629).
Also odd terms in A025020.

Examples

			x^2 == 2 (mod 45) has no solution, so 45 is a term.
		

Crossrefs

Cf. A003629. A047621 is a subsequence.
Cf. A058529, A057126, A025020 (numbers k such that x^2 == 2 (mod k) has no solution).

Programs

  • Maple
    filter:= proc(t) (numtheory:-factorset(t) mod 8) intersect {3,5} <> {} end proc:
    select(filter, [seq(i,i=1..1000,2)]); # Robert Israel, Nov 05 2019
  • Mathematica
    Reap[Do[If[AnyTrue[FactorInteger[k][[All, 1]], MatchQ[Mod[#, 8], 3|5]&], Sow[k]], {k, 1, 999, 2}]][[2, 1]] (* Jean-François Alcover, Aug 22 2020 *)
  • PARI
    isA329095(k) = (k%2) && !issquare(Mod(2,k))

A066507 Numbers k such that there is a solution to x^2 == 2^k (mod k).

Original entry on oeis.org

1, 2, 4, 6, 7, 8, 10, 12, 14, 16, 17, 18, 20, 22, 23, 24, 26, 28, 30, 31, 32, 34, 36, 38, 40, 41, 42, 44, 46, 47, 48, 49, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 71, 72, 73, 74, 76, 78, 79, 80, 82, 84, 86, 88, 89, 90, 92, 94, 96, 97, 98, 100, 102, 103, 104, 106, 108, 110
Offset: 1

Views

Author

Benoit Cloitre, Jan 04 2002

Keywords

Comments

All even numbers are in this sequence.
Odd terms in the sequence are numbers whose prime factors are +-1 (mod 8) (A058529), i.e., odd k such that x^2 == 2 (mod k) has a solution. - Jason Earls, Jan 22 2002

Crossrefs

Programs

  • PARI
    isok(n) = {for (x=0, n-1, if (Mod(x, n)^2 == Mod(2, n)^n, return (1));); return (0);} \\ Michel Marcus, Nov 20 2013

Extensions

Corrected by Vladeta Jovovic, Jan 22 2002
More terms from Jason Earls, Jan 22 2002

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

A333669 The smallest nontrivial quadratic residue modulo n.

Original entry on oeis.org

4, 3, 2, 4, 4, 4, 3, 4, 3, 2, 4, 4, 2, 4, 4, 4, 4, 3, 2, 4, 4, 3, 4, 4, 4, 4, 2, 4, 3, 2, 4, 4, 3, 4, 3, 4, 2, 4, 4, 4, 4, 2, 2, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 3, 2, 4, 4, 4, 3, 4, 4, 3, 4, 2, 4, 2, 3, 4, 4, 4, 3, 2, 4, 4, 2, 3, 4, 4, 4, 4, 4
Offset: 5

Views

Author

Peter Schorn, May 07 2020

Keywords

Comments

The values are 2, 3 and 4. If 2 is a square modulo n (see A057126) the value is 2. Otherwise, if 3 is a square modulo n (see A057125) the value is 3. If neither 2 or 3 are a square modulo n the value is 4.
Dedicated to Urs Meyer at the occasion of his 60th birthday.

Examples

			The squares modulo 5 are 1 and 4, therefore a(5) = 4.
Modulo 6 the squares are 1, 3 and 4 which makes a(6) = 3.
a(7) = 2 since 2 == 3^2 (mod 7).
		

Crossrefs

Cf. A057126 for the n where the value is 2 and A057125 for the n where the value is 3 if n was not in A057126.

Programs

  • Maple
    f:= proc(n) uses numtheory; if quadres(2,n)=1 then 2 elif quadres(3,n)=1 then 3 else 4 fi end proc:
    map(f, [$5..100]); # Robert Israel, Sep 15 2020
  • Mathematica
    qrQ[m_, n_] := Module[{k}, Reduce[Mod[m-k^2, n]==0, k, Integers] =!= False];
    a[n_] := If[qrQ[2, n], 2, If[qrQ[3, n], 3, 4]];
    a /@ Range[5, 100] (* Jean-François Alcover, Oct 25 2020 *)
  • PARI
    a(n) = if(issquare(Mod(2,n)),2,issquare(Mod(3,n)),3,4)
Previous Showing 11-20 of 24 results. Next