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-10 of 49 results. Next

A130290 Number of nonzero quadratic residues modulo the n-th prime.

Original entry on oeis.org

1, 1, 2, 3, 5, 6, 8, 9, 11, 14, 15, 18, 20, 21, 23, 26, 29, 30, 33, 35, 36, 39, 41, 44, 48, 50, 51, 53, 54, 56, 63, 65, 68, 69, 74, 75, 78, 81, 83, 86, 89, 90, 95, 96, 98, 99, 105, 111, 113, 114, 116, 119, 120, 125, 128, 131, 134, 135, 138, 140, 141, 146, 153, 155, 156, 158
Offset: 1

Views

Author

M. F. Hasler, May 21 2007

Keywords

Comments

Row lengths for formatting A063987 as a table: The number of nonzero quadratic residues modulo a prime p equals floor(p/2), or (p-1)/2 if p is odd. The number of squares including 0 is (p+1)/2, if p is odd (rows prime(i) of A096008 formatted as a table). In fields of characteristic 2, all elements are squares. For any m > 0, floor(m/2) is the number of even positive integers less than or equal to m, so a(n) also equals the number of even positive integers less than or equal to the n-th prime. For all n > 0, A130290(n+1) = A005097(n) = A102781(n+1) = A102781(n+1) = A130291(n+1)-1 = A111333(n+1)-1 = A006254(n)-1.
From Vladimir Shevelev, Jun 18 2016: (Start)
a(1)+2 and, for n >= 2, a(n)+1 is the smallest k such that there exists 0 < k_1 < k with the condition k_1^2 == k^2 (mod prime(n)).
Indeed, for n >= 2, if prime(n) = 4*t+1 then k = 2*t+1 = a(n)+1, since (2*t+1)^2 == (2*t)^2 (mod prime(n)) and there cannot be a smaller value of k; if prime(n) = 4*t-1, then k = 2*t = a(n)+1, since (2*t)^2 == (2*t-1)^2 (mod prime(n)). (End)
a(n) is the number of pairs (a,b) such that a + b = prime(n) with 1 <= a <= b. - Nicholas Leonard, Oct 02 2022

Examples

			a(1)=1 since the only nonzero element of Z/2Z equals its square.
a(3)=2 since 1=1^2=(-1)^2 and 4=2^2=(-2)^2 are the only nonzero squares in Z/5Z.
a(1000000) = 7742931 = (prime(1000000)-1)/2.
		

Crossrefs

Essentially the same as A005097.
Cf. A102781 (Number of even numbers less than the n-th prime), A063987 (quadratic residues modulo the n-th prime), A006254 (Numbers n such that 2n-1 is prime), A111333 (Number of odd numbers <= n-th prime), A000040 (prime numbers), A130291.
Appears in A217983. - Johannes W. Meijer, Oct 25 2012

Programs

Formula

a(n) = floor( A000040(n)/2 ) = #{ even positive integers <= A000040(n) }
a(n) = A055034(A000040(n)), n>=1. - Wolfdieter Lang, Sep 20 2012
a(n) = A005097(n-[n>1]) = A005097(max(n-1,1)). - M. F. Hasler, Dec 13 2019

A046071 Triangle of nonzero quadratic residues mod n.

Original entry on oeis.org

1, 1, 1, 1, 4, 1, 3, 4, 1, 2, 4, 1, 4, 1, 4, 7, 1, 4, 5, 6, 9, 1, 3, 4, 5, 9, 1, 4, 9, 1, 3, 4, 9, 10, 12, 1, 2, 4, 7, 8, 9, 11, 1, 4, 6, 9, 10, 1, 4, 9, 1, 2, 4, 8, 9, 13, 15, 16, 1, 4, 7, 9, 10, 13, 16, 1, 4, 5, 6, 7, 9, 11, 16, 17, 1, 4, 5, 9, 16, 1, 4, 7, 9, 15, 16, 18, 1, 3, 4, 5, 9, 11, 12
Offset: 2

Views

Author

Keywords

Comments

Rows start with 1's.

Examples

			1,
1,
1,
1, 4,
1, 3, 4,
1, 2, 4,
1, 4,
1, 4, 7,
1, 4, 5, 6, 9,
1, 3, 4, 5, 9,
1, 4, 9,
1, 3, 4, 9, 10, 12,
1, 2, 4, 7, 8, 9, 11
1, 4, 6, 9, 10,
- _Geoffrey Critzer_, Apr 03 2015
		

Crossrefs

Cf. A105612 (row lengths), A165909 (row sums), A372651 (row products).
Cf. A096008 (including zeros), A063987.

Programs

  • Haskell
    import Data.List (sort, nub, genericIndex)
    a046071 n k = genericIndex a046071_tabf (n-2) !! (k-1)
    a046071_row n = genericIndex a046071_tabf (n-2)
    a046071_tabf = f [1] 2 3 where
       f qs@(q:_) i j = ys : f ((q + j) : qs) (i + 1) (j + 2) where
                        ys = nub $ sort $ filter (> 0) $ map (flip mod i) qs
    -- Reinhard Zumkeller, May 10 2015
    
  • Maple
    seq(op(select(numtheory:-quadres=1,[$1..n-1],n)),n=2..30); # Robert Israel, Apr 03 2015
  • Mathematica
    residueQ[n_, k_] := Length[ Select[ Range[ Floor[k/2]]^2, Mod[#, k] == n & , 1]] == 1; row[n_] := Select[ Range[n-1], residueQ[#, n]& ]; Table[row[n], {n, 2, 22}] // Flatten (* Jean-François Alcover, Oct 23 2012 *)
    row[n_] := Table[PowerMod[k, 2, n], {k, 0, n-1}] // Union // Rest; Table[row[n], {n, 2, 22}] // Flatten (* Jean-François Alcover, Jul 07 2019 *)
  • PARI
    residue(n,m)={local(r);r=0;for(i=0,floor(m/2),if(i^2%m==n,r=1));r} \\ Michael B. Porter, May 03 2010
    
  • SageMath
    for n in range(2, 16): print(quadratic_residues(n)[1:]) # Peter Luschny, Jun 02 2024

Extensions

Edited by Franklin T. Adams-Watters, Nov 07 2006

A010461 Squares mod 100.

Original entry on oeis.org

0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
Offset: 1

Views

Author

Keywords

Comments

Range of A002015; subset of A122986. - Reinhard Zumkeller, Mar 21 2010

Crossrefs

Row 100 of A096008.
Cf. A028813.

Programs

  • Magma
    [n: n in [0..99] | IsSquare(R! n) where R:= ResidueClassRing(100)]; // Vincenzo Librandi, Dec 28 2019
  • Mathematica
    Union[PowerMod[Range[100], 2, 100]] (* Alonso del Arte, Dec 25 2019 *)
  • PARI
    A010461=Set(vector(100,n,n^2)%100) \\ M. F. Hasler, Mar 03 2014
    
  • Sage
    [quadratic_residues(100)] # Zerinvary Lajos, May 28 2009
    
  • Scala
    (1 to 100).map(n => (n * n) % 100).toSet.toSeq.sorted // Alonso del Arte, Dec 25 2019
    

A122986 Squares mod 1000.

Original entry on oeis.org

0, 1, 4, 9, 16, 24, 25, 36, 41, 44, 49, 56, 64, 76, 81, 84, 89, 96, 100, 104, 116, 121, 124, 129, 136, 144, 156, 161, 164, 169, 176, 184, 196, 201, 204, 209, 216, 224, 225, 236, 241, 244, 249, 256, 264, 276, 281, 284, 289, 296, 304, 316, 321, 324, 329, 336, 344
Offset: 1

Views

Author

Sergio Pimentel, Sep 22 2006

Keywords

Comments

Possible last three digits of n^2 (leading zeros omitted).
Range of A174452; A010461 is a subset; and also all squares less than 1000 belong to this sequence; the sequence is finite with A000993(3)=159 terms: a(159)=996 is the last term.

Examples

			The last three digits of n^2 can be 000, 001, 236, 241, 996, etc. but not 002, 003, 237, 238, etc.
		

Crossrefs

Programs

  • Magma
    [n: n in [0..999] | IsSquare(R! n) where R:= ResidueClassRing(1000)]; // Vincenzo Librandi, Dec 29 2019
  • Maple
    s:={}: for n from 0 to 999 do s:=s union {n^2 mod 1000}: od: op(s); # Nathaniel Johnston, Jun 22 2011
  • Mathematica
    Union[PowerMod[Range[1000], 2, 1000]] (* Vincenzo Librandi, Dec 29 2019 *)

Extensions

More terms and additional comments from Reinhard Zumkeller, Mar 21 2010
Edited by N. J. A. Sloane, Apr 10 2010

A010376 Squares mod 13.

Original entry on oeis.org

0, 1, 3, 4, 9, 10, 12
Offset: 1

Views

Author

Keywords

Crossrefs

Row 13 of A096008.
Cf. A028726.

Programs

  • Mathematica
    Union[PowerMod[Range[13], 2, 13]] (* Alonso del Arte, Dec 13 2019 *)
  • Sage
    [quadratic_residues(13)] # Zerinvary Lajos, May 24 2009
    
  • Scala
    (1 to 13).map(n => (n * n) % 13).toSet.toSeq.sorted // Alonso del Arte, Dec 13 2019

A010382 Squares mod 20.

Original entry on oeis.org

0, 1, 4, 5, 9, 16
Offset: 1

Views

Author

Keywords

Comments

Range of A070442. - Reinhard Zumkeller, Apr 24 2009

Crossrefs

Row 20 of A096008.
Cf. A028733.

Programs

  • Mathematica
    Union[PowerMod[Range[20], 2, 20]] (* Alonso del Arte, Dec 20 2019 *)
  • Sage
    [quadratic_residues(20)] # Zerinvary Lajos, May 24 2009
    
  • Scala
    (1 to 20).map(n => (n * n) % 20).toSet.toSeq.sorted // Alonso del Arte, Dec 20 2019

A010421 Squares mod 60.

Original entry on oeis.org

0, 1, 4, 9, 16, 21, 24, 25, 36, 40, 45, 49
Offset: 1

Views

Author

Keywords

Comments

Range of A159852. - Reinhard Zumkeller, Apr 24 2009

Crossrefs

Row 60 of A096008.

Programs

  • Magma
    [n: n in [0..59] | IsSquare(R! n) where R:= ResidueClassRing(60)]; // Vincenzo Librandi, Jan 05 2020
  • Mathematica
    Union[PowerMod[Range[60], 2, 60]] (* Alonso del Arte, Jan 03 2020 *)
  • Sage
    [quadratic_residues(60)] # Zerinvary Lajos, May 24 2009
    
  • Scala
    (1 to 60).map(n => n * n % 60).toSet.toSeq.sorted // Alonso del Arte, Jan 03 2020
    

A010462 Squares mod 30.

Original entry on oeis.org

0, 1, 4, 6, 9, 10, 15, 16, 19, 21, 24, 25
Offset: 1

Views

Author

Keywords

Comments

Range of A070452; a(k) + a(13-k) = 25, 1 <= k <= 12. - Reinhard Zumkeller, Apr 24 2009

Examples

			3^2 = 9, so 9 is in the sequence.
10^2 and 20^2 are both congruent to 10 mod 30, so 10 is in the sequence.
There are no solutions to x^2 = 11 mod 30, so 11 is not in the sequence.
		

Crossrefs

Row 30 of A096008.
Cf. A028743.

Programs

A260182 Smallest square that is pandigital in base n.

Original entry on oeis.org

4, 64, 225, 5329, 38025, 314721, 3111696, 61058596, 1026753849, 31529329225, 892067027049, 307197306432025, 803752551280900, 29501156485626049, 1163446635475467225, 830482914641378019961, 2200667320658951859841, 104753558229986901966129, 5272187100814113874556176
Offset: 2

Views

Author

Jon E. Schoenfield, Jul 17 2015

Keywords

Comments

Compare this sequence with A260117, Smallest triangular number that is pandigital in base n. Presumably, lim_{n->infinity} A260117(n)/A049363(n) = 1, but the same cannot be true for this sequence: the sum of the base-n digits of a number that is pandigital in base n must be 0+1+2+...+n-1 = binomial(n,2), but there are certain values of n for which no n-digit square can have a digit sum of binomial(n,2); for such values of n, a(n) must have more than n digits in base n. [E.g., the base-13 expansion of every square has a digit sum s == {0,1,4,9} (mod 12) (cf. A096008), but a square that is pandigital in base 13 and has exactly 13 digits would have a digit sum s = 78 == 6 (mod 12), so no such number exists; a 14-digit base-13 pandigital square would have each of the digits 0..12 exactly once except for one duplicated digit, which would have to be 3, 6, 7, or 10 (to yield a digit sum of 81, 84, 85, or 88, whose residues modulo 12 are 9, 0, 1, and 4, respectively). - Jon E. Schoenfield, Mar 23 2019]
The values of n for which there exists no pandigital square that is exactly n digits long (in base n) begin with 2, 3, 5, 13, 17, 21, ...; presumably, for all such values of n, a(n) is exactly n+1 base-n digits long.
In base 2, there are no 2-digit squares at all, so a(2) must have more than 2 binary digits. For n = 3, 5, 13, 17, 21, ..., there exists no square, regardless of its number of digits, whose base-n digit sum equals binomial(n,2); see A260191.

Examples

			Using the letters a, b, c, ... to represent digit values 10, 11, 12, ..., the terms begin as follows:
.
   n            a(n) in base 10          a(n) in base n
  ==  =========================  ======================
   2                          4                   100_2
   3                         64                  2101_3
   4                        225                  3201_4
   5                       5329                132304_5
   6                      38025                452013_6
   7                     314721               2450361_7
   8                    3111696              13675420_8
   9                   61058596             136802574_9
  10                 1026753849            1026753849_10
  11                31529329225           1240a536789_11
  12               892067027049          124a7b538609_12
  13            307197306432025        10254773ca86b9_13
  14            803752551280900        10269b8c57d3a4_14
  15          29501156485626049       102597bace836d4_15
  16        1163446635475467225      1025648cfea37bd9_16
  17      830482914641378019961    101246a89cgfb357ed_17
  18     2200667320658951859841    10236b5f8eg4ad9ch7_18
  19   104753558229986901966129   10234dhbg7ci8f6a9e5_19
  20  5272187100814113874556176  1024e7cdi3hb695fja8g_20
		

Crossrefs

A130291 Number of quadratic residues (including 0) modulo the n-th prime.

Original entry on oeis.org

2, 2, 3, 4, 6, 7, 9, 10, 12, 15, 16, 19, 21, 22, 24, 27, 30, 31, 34, 36, 37, 40, 42, 45, 49, 51, 52, 54, 55, 57, 64, 66, 69, 70, 75, 76, 79, 82, 84, 87, 90, 91, 96, 97, 99, 100, 106, 112, 114, 115, 117, 120, 121, 126, 129, 132, 135, 136, 139, 141, 142, 147, 154, 156, 157
Offset: 1

Views

Author

M. F. Hasler, May 21 2007

Keywords

Comments

The number of squares (quadratic residues including 0) modulo a prime p (sequence A096008 with every "1" prefixed by a "0") equals 1+floor(p/2), or ceiling(p/2) = (p+1)/2 if p is odd. (In fields of characteristic 2, all elements are squares.) See A130290(n)=A130291(n)-1 for number of nonzero residues. For all n>0, A130291(n+1) = A111333(n+1) = A006254(n) = A005097(n)-1 = A102781(n+1)-1 = A102781(n+1)-1 = A130290(n+1)-1.

Examples

			a(1)=2 since both elements of Z/2Z are squares.
a(3)=0 since 0=0^2, 1=1^2=(-1)^2 and 4=2^2=(-2)^2 are squares in Z/5Z.
a(1000000) = 7742932 = (p[1000000]+1)/2.
		

Crossrefs

Essentially the same as A006254.
Cf. A005097 (Odd primes - 1)/2, A102781 (Integer part of n#/(n-2)#/2#), A102781 (Number of even numbers less than the n-th prime), A063987 (quadratic residues modulo the n-th prime), A006254 (Numbers n such that 2n-1 is prime), A111333 (Number of odd numbers <= n-th prime), A000040 (prime numbers), A130290 (number of nonzero residues modulo primes).

Programs

Formula

a(n) = floor( A000040(n)/2 )+1
Showing 1-10 of 49 results. Next