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 17 results. Next

A225126 Central terms of the triangle in A048152.

Original entry on oeis.org

0, 1, 4, 2, 7, 3, 10, 4, 13, 5, 16, 6, 19, 7, 22, 8, 25, 9, 28, 10, 31, 11, 34, 12, 37, 13, 40, 14, 43, 15, 46, 16, 49, 17, 52, 18, 55, 19, 58, 20, 61, 21, 64, 22, 67, 23, 70, 24, 73, 25, 76, 26, 79, 27, 82, 28, 85, 29, 88, 30, 91, 31, 94, 32, 97, 33, 100
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 29 2013

Keywords

Comments

a(n) = A123684(n) for n > 1;
a(n) = A048152(2*n-1,n), central terms;
also a(n) = A060036(2*n-1,n-1) for n > 1.
a(n+1)=the remainder when n^2 is divided by 2n+1. - J. M. Bergot, Jun 25 2013

Programs

Formula

a(1) = 0, a(2*n) = n and a(2*n+1) = 3*n+1.
a(n) = 2*a(n-2)-a(n-4) for n>5. G.f.: -x^2*(x^3-4*x-1) / ((x-1)^2*(x+1)^2). - Colin Barker, May 01 2013

A063987 Irregular triangle in which n-th row gives quadratic residues modulo the n-th prime.

Original entry on oeis.org

1, 1, 1, 4, 1, 2, 4, 1, 3, 4, 5, 9, 1, 3, 4, 9, 10, 12, 1, 2, 4, 8, 9, 13, 15, 16, 1, 4, 5, 6, 7, 9, 11, 16, 17, 1, 2, 3, 4, 6, 8, 9, 12, 13, 16, 18, 1, 4, 5, 6, 7, 9, 13, 16, 20, 22, 23, 24, 25, 28, 1, 2, 4, 5, 7, 8, 9, 10, 14, 16, 18, 19, 20, 25, 28, 1, 3, 4, 7, 9, 10, 11, 12, 16, 21, 25
Offset: 1

Views

Author

Suggested by Gary W. Adamson, Sep 18 2001

Keywords

Comments

For n >= 2, row lengths are (prime(n) - 1)/2. For example, since 17 is the 7th prime number, the length of row 7 is (17 - 1)/2 = 8. - Geoffrey Critzer, Apr 04 2015

Examples

			Modulo the 5th prime, 11, the (11 - 1)/2 = 5 quadratic residues are 1,3,4,5,9 and the 5 non-residues are 2, 6, 7, 8, 10.
The irregular triangle T(n, k) begins (p is prime(n)):
   n    p  \k 1 2 3 4  5  6  7  8  9 10 11 12 13 14
   1,   2:    1
   2,   3:    1
   3,   5:    1 4
   4,   7:    1 2 4
   5,  11:    1 3 4 5  9
   6:  13:    1 3 4 9 10 12
   7,  17:    1 2 4 8  9 13 15 16
   8,  19:    1 4 5 6  7  9 11 16 17
   9,  23:    1 2 3 4  6  8  9 12 13 16 18
  10,  29:    1 4 5 6  7  9 13 16 20 22 23 24 25 28
  ...  reformatted by _Wolfdieter Lang_, Mar 06 2016
		

References

  • Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See Table 82 at p. 202.

Crossrefs

Cf. A063988, A010379 (6th row), A010381 (7th row), A010385 (8th row), A010391 (9th row), A010392 (10th row), A278580 (row 23), A230077.
Cf. A076409 (row sums).
Cf. A046071 (for all n), A048152 (for all n, with 0's).

Programs

  • Maple
    with(numtheory): for n from 1 to 20 do for j from 1 to ithprime(n)-1 do if legendre(j, ithprime(n)) = 1 then printf(`%d,`,j) fi; od: od:
    # Alternative:
    QR := (a, n) -> NumberTheory:-QuadraticResidue(a, n):
    for n from 1 to 10 do p := ithprime(n):
    print(select(a -> 1 = QR(a, p), [seq(1..p-1)])) od:  # Peter Luschny, Jun 02 2024
  • Mathematica
    row[n_] := (p = Prime[n]; Select[ Range[p - 1], JacobiSymbol[#, p] == 1 &]); Flatten[ Table[ row[n], {n, 1, 12}]] (* Jean-François Alcover, Dec 21 2011 *)
  • PARI
    residue(n,m)=local(r);r=0;for(i=0,floor(m/2),if(i^2%m==n,r=1));r
    isA063987(n,m)=residue(n,prime(m)) /* Michael B. Porter, May 07 2010 */
    
  • PARI
    row(n) = my(p=prime(n)); select(x->issquare(Mod(x,p)), [1..p-1]); \\ Michel Marcus, Nov 07 2020
    
  • Python
    from sympy import jacobi_symbol as J, prime
    def a(n):
        p = prime(n)
        return [1] if n==1 else [i for i in range(1, p) if J(i, p)==1]
    for n in range(1, 11): print(a(n)) # Indranil Ghosh, May 27 2017
    
  • SageMath
    for p in prime_range(30): print(quadratic_residues(p)[1:])
    # Peter Luschny, Jun 02 2024

Extensions

Edited by Wolfdieter Lang, Mar 06 2016

A048153 a(n) = Sum_{k=1..n} (k^2 mod n).

Original entry on oeis.org

0, 1, 2, 2, 10, 13, 14, 12, 24, 45, 44, 38, 78, 77, 70, 56, 136, 129, 152, 130, 182, 209, 184, 148, 250, 325, 288, 294, 406, 365, 372, 304, 484, 561, 490, 402, 666, 665, 572, 540, 820, 805, 860, 726, 840, 897, 846, 680, 980, 1125, 1156, 1170, 1378, 1305, 1210
Offset: 1

Views

Author

Keywords

Comments

See A048152 for the array T[n,k] = k^2 mod n.
Starting with a(2)=1 each 4th term is odd: a(n=2+4*k) = 1, 13, 45, 77, 129, 209, 325, 365, ... - Zak Seidov, Apr 22 2009
Positions of squares in A048153: 1, 2, 33, 51, 69, 105, 195, 250, 294, 1250, 4913, 9583, 13778, 48778, 65603, 83521.
Corresponding values of squares are: {0, 1, 22, 34, 46, 70, 130, 175, 203, 875, 3468, 6734, 9711, 34481, 46308, 58956}^2 = {0, 1, 484, 1156, 2116, 4900, 16900, 30625, 41209, 765625, 12027024, 45346756, 94303521, 1188939361, 2144430864, 3475809936}. - Zak Seidov, Nov 02 2011
For n > 1 also row sums of A060036. - Reinhard Zumkeller, Apr 29 2013
Conjecture: a(n) <= (n^2-1)/2. - Aspen A.M. Meissner, Mar 06 2025

Examples

			a(5) = 1^2 + 2^2 + (3^2 mod 5) + (4^2 mod 5) + (5^2 mod 5) = 1 + 4 + 4 + 1 + 0 = 10. (It is easily seen that the last term, n^2 mod n, is always zero and would not need to be included.) - _M. F. Hasler_, Oct 21 2013
		

Crossrefs

Programs

Formula

a(n) == n*(n+1)*(2n+1)/6 (mod n). - Charles R Greathouse IV, Dec 28 2011
a(n) == n*(n-1)*(2n-1)/6 (mod n). - Chai Wah Wu, Jun 02 2024
a(n) mod n = A215573(n). - Alois P. Heinz, Jun 03 2024

Extensions

Definition made more explicit by M. F. Hasler, Oct 21 2013

A133819 Triangle whose rows are sequences of increasing squares: 1; 1,4; 1,4,9; ... .

Original entry on oeis.org

1, 1, 4, 1, 4, 9, 1, 4, 9, 16, 1, 4, 9, 16, 25, 1, 4, 9, 16, 25, 36, 1, 4, 9, 16, 25, 36, 49, 1, 4, 9, 16, 25, 36, 49, 64, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144
Offset: 1

Views

Author

Peter Bala, Sep 25 2007

Keywords

Comments

Reading the triangle by rows produces the sequence 1,1,4,1,4,9,1,4,9,16,..., analogous to A002260.
Sequence B is called a reluctant sequence of sequence A, if B is triangle array read by rows: row number k coincides with first k elements of the sequence A. A133819 is reluctant sequence of A000290. - Boris Putievskiy, Jan 11 2013

Examples

			The triangle T(n, k) starts:
1;
1, 4;
1, 4, 9;
1, 4, 9, 16;
1, 4, 9, 16, 25;
		

Crossrefs

Programs

  • Haskell
    a133819 n k = a133819_tabl !! (n-1) !! (k-1)
    a133819_row n = a133819_tabl !! (n-1)
    a133819_tabl = map (`take` (tail a000290_list)) [1..]
    -- Reinhard Zumkeller, Nov 11 2012
  • Mathematica
    With[{sqs=Range[12]^2},Flatten[Table[Take[sqs,n],{n,12}]]] (* Harvey P. Dale, Sep 09 2012 *)

Formula

T(n, k) = k^2, n >= k >= 1. - Wolfdieter Lang, Dec 02 2014
O.g.f.: (1+qx)/((1-x)(1-qx)^3) = 1 + x(1 + 4q) + x^2(1 + 4q + 9q^2) + ... .
a(n) = A000290(m+1), where m = n-t(t+1)/2, t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Jan 11 2013

Extensions

Offset changed by Reinhard Zumkeller, Nov 11 2012

A070442 a(n) = n^2 mod 20.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 12 2002

Keywords

Comments

Also, n^6 mod 20.
Equivalently n^10 mod 20. - Zerinvary Lajos, Oct 31 2009

Crossrefs

Programs

Formula

From Reinhard Zumkeller, Apr 24 2009: (Start)
a(m*n) = a(m)*a(n) mod 20.
a(5*n+k) = a(5*n-k) for k <= 5*n.
a(n+10) = a(n). (End)
G.f. -x*(1+4*x+9*x^2+16*x^3+5*x^4+16*x^5+9*x^6+4*x^7+x^8) / ( (x-1) *(1+x) *(x^4+x^3+x^2+x+1) *(x^4-x^3+x^2-x+1) ). - R. J. Mathar, Aug 27 2013

A070438 a(n) = n^2 mod 15.

Original entry on oeis.org

0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6, 4, 4, 6, 10, 1, 9, 4, 1, 0, 1, 4, 9, 1, 10, 6
Offset: 0

Views

Author

N. J. A. Sloane, May 12 2002

Keywords

Comments

Equivalently, n^6 mod 15. - Ray Chandler, Dec 27 2023

Crossrefs

Programs

Formula

From Reinhard Zumkeller, Apr 24 2009: (Start)
a(m*n) = a(m)*a(n) mod 15.
a(15*n+7+k) = a(15*n+8-k) for k <= 15*n+7.
a(15*n+k) = a(15*n-k) for k <= 15*n.
a(n+15) = a(n). (End)
From R. J. Mathar, Mar 14 2011: (Start)
a(n) = a(n-15).
G.f.: -x*(1+x) *(x^12+3*x^11+6*x^10-5*x^9+15*x^8-9*x^7+13*x^6-9*x^5+15*x^4-5*x^3+6*x^2+3*x+1) / ( (x-1) *(1+x^4+x^3+x^2+x) *(1+x+x^2) *(1-x+x^3-x^4+x^5-x^7+x^8) ). (End)
G.f.: (x^14 +4*x^13 +9*x^12 +x^11 +10*x^10 +6*x^9 +4*x^8 +4*x^7 +6*x^6 +10*x^5 +x^4 +9*x^3 +4*x^2 +x)/(-x^15 +1). - Colin Barker, Aug 14 2012

A049759 Triangular array T read by rows: T(n,k)=n^2 mod k, for k=1,2,...,n, n=1,2,...

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 4, 1, 0, 0, 0, 1, 0, 4, 4, 1, 0, 0, 1, 0, 1, 1, 3, 4, 1, 0, 0, 0, 1, 0, 0, 4, 2, 4, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 4, 1, 0, 0, 0, 0, 0, 4, 0, 4, 0, 0, 4, 1, 0, 0, 1, 1, 1, 4, 1, 1, 1, 7, 9, 4, 1, 0
Offset: 1

Views

Author

Keywords

Examples

			Triangle begins:
  0;
  0, 0;
  0, 1, 0;
  0, 0, 1, 0;
  0, 1, 1, 1, 0;
  0, 0, 0, 0, 1, 0;
  0, 1, 1, 1, 4, 1, 0;
  0, 0, 1, 0, 4, 4, 1, 0;
  0, 1, 0, 1, 1, 3, 4, 1, 0;
  0, 0, 1, 0, 0, 4, 2, 4, 1, 0;
  0, 1, 1, 1, 1, 1, 2, 1, 4, 1, 0;
  0, 0, 0, 0, 4, 0, 4, 0, 0, 4, 1, 0;
  0, 1, 1, 1, 4, 1, 1, 1, 7, 9, 4, 1, 0;
		

Crossrefs

Cf. A048152.

Programs

  • GAP
    Flat(List([1..15], n-> List([1..n], k-> PowerMod(n,2,k) ))); # G. C. Greubel, Dec 13 2019
  • Magma
    [[Modexp(n,2,k): k in [1..n]]: n in [1..15]]; // G. C. Greubel, Dec 13 2019
    
  • Maple
    seq(seq( `mod`(n^2, k), k = 1..n), n = 1..15); # G. C. Greubel, Dec 13 2019
  • Mathematica
    Table[PowerMod[n,2,k], {n,15}, {k,n}]//Flatten (* G. C. Greubel, Dec 13 2019 *)
  • PARI
    tabl(nn) = {for (n=1, nn, for (k=1, n, print1(n^2 % k, ", ");); print(););} \\ Michel Marcus, Mar 31 2014
    
  • Sage
    [[power_mod(n,2,k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 13 2019
    

A060036 Triangular array T read by rows: T(n,k) = k^2 mod n, for k = 1,2,...,n-1, n = 2,3,...

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 17 2001

Keywords

Comments

T(n,k) = A048152(n-1,k), 1 <= k < n; T(2*n-1,n-1) = A123684(n-1) = A225126(n-1). - Reinhard Zumkeller, Apr 29 2013

Examples

			The triangle T(n,k) begins:
n\k 1 2 3 4 5 6 7 8 9 10 11 ...
-------------------------------
2:  1
3:  1 1
4:  1 0 1
5:  1 4 4 1
6:  1 4 3 4 1
7:  1 4 2 2 4 1
6:  1 4 1 0 1 4 1
9:  1 4 0 7 7 0 4 1
10: 1 4 9 6 5 6 9 4 1
11: 1 4 9 5 3 3 5 9 4  1
12: 1 4 9 4 1 0 1 4 9  4  1
...  reformatted by - _Wolfdieter Lang_, Dec 17 2018
		

Crossrefs

Cf. A048153 (row sums).

Programs

  • Haskell
    a060036 n k = a060036_tabl !! (n-2) !! (k-1)
    a060036_row n = a060036_tabl !! (n-2)
    a060036_tabl = map init $ tail a048152_tabl
    -- Reinhard Zumkeller, Apr 29 2013
  • Mathematica
    Flatten[Table[PowerMod[k,2,n],{n,2,20},{k,n-1}]] (* Harvey P. Dale, Feb 27 2012 *)
  • PARI
    { n=1; for (m=2, 46, for (k=1, m-1, write("b060036.txt", n++, " ", k^2 % m)); ) } \\ Harry J. Smith, Jul 01 2009
    

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 20 2001

A049767 Triangular array T, read by rows: T(n,k) = (k^2 mod n) + (n^2 mod k), for k = 1..n and n >= 1.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Triangle T(n,k) (with rows n >= 1 and columns k >= 1) begins as follows:
  0;
  1,  0;
  1,  2,  0;
  1,  0,  2,  0;
  1,  5,  5,  2,  0;
  1,  4,  3,  4,  2,  0;
  1,  5,  3,  3,  8,  2,  0;
  1,  4,  2,  0,  5,  8,  2,  0;
  1,  5,  0,  8,  8,  3,  8,  2,  0;
  1,  4, 10,  6,  5, 10, 11,  8,  2,  0;
  ...
		

Crossrefs

Row sums are in A049768.

Programs

  • GAP
    Flat(List([1..15], n-> List([1..n], k-> PowerMod(k,2,n) + PowerMod(n,2,k) ))); # G. C. Greubel, Dec 13 2019
  • Magma
    [[Modexp(k,2,n) + Modexp(n,2,k): k in [1..n]]: n in [1..15]]; // G. C. Greubel, Dec 13 2019
    
  • Maple
    seq(seq( `mod`(k^2, n) + `mod`(n^2, k), k = 1..n), n = 1..15); # G. C. Greubel, Dec 13 2019
  • Mathematica
    Table[PowerMod[k,2,n] + PowerMod[n,2,k], {n,15}, {k,n}]//Flatten (* G. C. Greubel, Dec 13 2019 *)
  • PARI
    T(n,k) = lift(Mod(k,n)^2) + lift(Mod(n,k)^2);
    for(n=1,15, for(k=1,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Dec 13 2019
    
  • Sage
    [[power_mod(k,2,n) + power_mod(n,2,k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 13 2019
    

Formula

T(n, k) = A048152(n, k) + A049759(n, k). - Michel Marcus, Nov 21 2019

A373749 Triangle read by rows: T(n, k) = MOD(k^2, n) where MOD(a, n) = a if n = 0 and otherwise a - n*floor(a/n). (Quadratic residue.)

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 4, 4, 1, 0, 0, 1, 4, 3, 4, 1, 0, 0, 1, 4, 2, 2, 4, 1, 0, 0, 1, 4, 1, 0, 1, 4, 1, 0, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0, 0, 1, 4, 9, 5, 3, 3, 5, 9, 4, 1, 0, 0, 1, 4, 9, 4, 1, 0, 1, 4, 9, 4, 1, 0
Offset: 0

Views

Author

Peter Luschny, Jun 23 2024

Keywords

Comments

The definition of the binary operation MOD in the name follows CMath (Graham et al.) and Bach & Shallit. This is important because some CAS unfortunately do not follow this definition and throw a 'division by zero' error if n = 0.
Row n reduced to a set is the set of the quadratic residues mod n.

Examples

			Triangle starts:
  [0] 0;
  [1] 0, 0;
  [2] 0, 1, 0;
  [3] 0, 1, 1, 0;
  [4] 0, 1, 0, 1, 0;
  [5] 0, 1, 4, 4, 1, 0;
  [6] 0, 1, 4, 3, 4, 1, 0;
  [7] 0, 1, 4, 2, 2, 4, 1, 0;
  [8] 0, 1, 4, 1, 0, 1, 4, 1, 0;
  [9] 0, 1, 4, 0, 7, 7, 0, 4, 1, 0;
 [10] 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0;
		

References

  • Eric Bach and Jeffrey Shallit, Algorithmic Number Theory, p. 21.
  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 2nd ed., pp. 81f.

Crossrefs

Variants: A048152, A096008.
Cf. A048153 (row sums), A373750 (middle terms).

Programs

  • Julia
    Mod(n, k) = k == 0 ? n : mod(n, k)
    T(n, k) = Mod(k^2, n)
    for n in 0:10
        [T(n, k) for k in 0:n] |> println
    end
    
  • Maple
    REM := (n, k) -> ifelse(k = 0, n, irem(n, k)):
    T := n -> local k; seq(REM(k^2, n), k = 0..n):
    seq(T(n), n = 0..12);
  • Mathematica
    MOD[n_, k_] := If[k == 0, n, Mod[n, k]];
    Table[MOD[k^2, n], {n, 0, 10}, {k, 0, n}]
  • SageMath
    def A373749(n, k): return mod(k^2, n)
    for n in range(11): print([A373749(n, k) for k in range(n + 1)])
Showing 1-10 of 17 results. Next