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

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

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Rows:
  0;
  1, 0;
  1, 1, 0;
  1, 0, 1, 0;
  1, 4, 4, 1, 0;
  1, 4, 3, 4, 1, 0;
		

Crossrefs

Cf. A060036.
Cf. A225126 (central terms).
Cf. A070430 (row 5), A070431 (row 6), A053879 (row 7), A070432 (row 8), A008959 (row 10), A070435 (row 12), A070438 (row 15), A070422 (row 20).
Cf. A046071 (in ascending order, without zeros and duplicates).
Cf. A063987 (for primes, in ascending order, without zeros and duplicates).

Programs

  • Haskell
    a048152 n k = a048152_tabl !! (n-1) !! (k-1)
    a048152_row n = a048152_tabl !! (n-1)
    a048152_tabl = zipWith (map . flip mod) [1..] a133819_tabl
    -- Reinhard Zumkeller, Apr 29 2013
  • Mathematica
    Flatten[Table[PowerMod[k,2,n],{n,15},{k,n}]] (* Harvey P. Dale, Jun 20 2011 *)

Formula

T(n,k) = A133819(n,k) mod n, k = 1..n. - Reinhard Zumkeller, Apr 29 2013
T(n,k) = (T(n,k-1) + (2k+1)) mod n. - Andrés Ventas, Apr 06 2021

A053879 a(n) = n^2 mod 7.

Original entry on oeis.org

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

Views

Author

Stuart M. Ellerstein (ellerstein(AT)aol.com), Apr 01 2000

Keywords

Crossrefs

Programs

Formula

Periodic with period 7.
G.f.: -x*(1+x)*(x^4 + 3*x^3 - x^2 + 3*x + 1) / ( (x-1)*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6) ). - R. J. Mathar, Feb 24 2011

Extensions

More terms from James Sellers, Apr 08 2000

A070434 a(n) = n^2 mod 11.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 12 2002

Keywords

Crossrefs

Programs

Formula

From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-11).
G.f.: ( -x*(1+x)*(x^8+3*x^7+6*x^6-x^5+4*x^4-x^3+6*x^2+3*x+1) ) / ( (x-1)*(1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8+x^9+x^10) ). (End)
a(n) = A010880(n^2). - Michel Marcus, Mar 24 2016

A070432 Period 4: repeat [0, 1, 4, 1]; a(n) = n^2 mod 8.

Original entry on oeis.org

0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0
Offset: 0

Views

Author

N. J. A. Sloane, May 12 2002

Keywords

Comments

Multiplicative with a(2) = 4, a(2^e) = 0 if e >= 2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005

Examples

			G.f. = x + 4*x^2 + x^3 + x^5 + 4*x^6 + x^7 + x^9 + 4*x^10 + x^11 + x^13 + ...
		

Crossrefs

Programs

Formula

From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-4) for n > 3.
G.f.: -x*(1+4*x+x^2) / ( (x-1)*(1+x)*(x^2+1) ). (End)
Dirichlet g.f.: zeta(s)*(1 + 4*2^(-s))*(1 - 2^(-s)). - R. J. Mathar, Mar 10 2011
a(n) = (n mod 2) + 4*floor(((n+1) mod 4)/3). - Gary Detlefs, Dec 29 2011
From Wesley Ivan Hurt, Mar 19 2015: (Start)
a(n) = (((n+1) mod 4) - 1)^2.
a(n) = (1 + (-1)^n - 2(-1)^((2n + 1 - (-1)^n)/4))^2/4. (End)
E.g.f.: 2*cosh(x) + sinh(x) - 2*cos(x). - G. C. Greubel, Mar 22 2016
a(n) = (3 + cos(n*Pi) - 4*cos(n*Pi/2))/2. - Wesley Ivan Hurt, Dec 21 2016
a(n) = a(-n) for all n in Z. - Michael Somos, Dec 22 2016

A186646 Every fourth term of the sequence of natural numbers 1,2,3,4,... is halved.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 7, 4, 9, 10, 11, 6, 13, 14, 15, 8, 17, 18, 19, 10, 21, 22, 23, 12, 25, 26, 27, 14, 29, 30, 31, 16, 33, 34, 35, 18, 37, 38, 39, 20, 41, 42, 43, 22, 45, 46, 47, 24, 49, 50, 51, 26, 53, 54, 55, 28, 57, 58, 59, 30, 61, 62, 63, 32, 65, 66, 67, 34, 69, 70, 71, 36, 73, 74, 75, 38, 77, 78, 79, 40, 81, 82, 83, 42, 85, 86, 87, 44, 89, 90, 91, 46, 93, 94, 95, 48, 97, 98, 99
Offset: 1

Views

Author

R. J. Mathar, Feb 25 2011

Keywords

Comments

a(n) is the length of the period of the sequence k^2 mod n, k=1,2,3,4,..., i.e., the length of the period of A000035 (n=2), A011655 (n=3), A000035 (n=4), A070430 (n=5), A070431 (n=6), A053879 (n=7), A070432 (n=8), A070433 (n=9), A008959 (n=10), A070434 (n=11), A070435 (n=12) etc.
From Franklin T. Adams-Watters, Feb 24 2011: (Start)
Clearly if gcd(n,m) = 1, a(nm) = lcm(a(n),a(m)), so it suffices to establish this for prime powers.
If p is a prime, the period must divide p, but k^2 mod p is not constant, so a(p) = p.
a(p^e), e > 1, must be divisible by a(p^(e-1)), and must divide p^e. If p != 2, (p^(e-1)+1)^2 = p^(2e-2)+2p^(e-1)+1 == 2p^(e-1)+1 (mod p^2), so a(p^e) != p^(e-1); it must then be e.
By inspection, a(4) = 2 and a(8) = 4.
This leaves a(2^e), e > 3. But then (2^(e-2)+1)^2 = 2^(2e-4)+2^(e-1)+1 == 2^(e-1)+1 (mod 2^e), so a(n) > 2^(e-2). On the other hand, (2^(e-1)+c)^2 = 2^(2e-2)+c2^e+c^2 == c^2 (mod 2^e). Hence the period is 2^(e-1). (End)

Crossrefs

Cf. A000224 (size of the set of moduli of k^2 mod n), A019554, A060819, A061037, A090129, A142705, A164115, A283971.

Programs

  • Maple
    A186646 := proc(n) if n mod 4 = 0 then n/2 ; else n ; end if; end proc ;
  • Mathematica
    Flatten[Table[{n,n+1,n+2,(n+3)/2},{n,1,101,4}]] (* or *) LinearRecurrence[ {0,0,0,2,0,0,0,-1},{1,2,3,2,5,6,7,4},100] (* Harvey P. Dale, May 30 2014 *)
    Table[n (7 - (-1)^n - 2 Cos[n Pi/2])/8, {n, 100}] (* Federico Provvedi , Jan 02 2018 *)
  • PARI
    a(n)=if(n%4,n,n/2) \\ Charles R Greathouse IV, Oct 16 2015
    
  • Python
    def A186646(n): return n if n&3 else n>>1 # Chai Wah Wu, Jan 10 2023

Formula

a(n) = 2*a(n-4) - a(n-8).
a(4n) = 2n; a(4n+1) = 4n+1; a(4n+2) = 4n+2; a(4n+3) = 4n+3.
a(n) = n/A164115(n).
G.f.: x*(1 + 2*x + 3*x^2 + 2*x^3 + 3*x^4 + 2*x^5 + x^6) / ( (x-1)^2*(1+x)^2*(x^2+1)^2 ).
Dirichlet g.f.: (1-2/4^s)*zeta(s-1).
A019554(n) | a(n). - Charles R Greathouse IV, Feb 24 2011
a(n) = n*(7 - (-1)^n - (-i)^n - i^n)/8, with i=sqrt(-1). - Bruno Berselli, Feb 25 2011
Multiplicative with a(p^e)=2^e if p=2 and e<=1; a(p^e)=2^(e-1) if p=2 and e>=2; a(p^e)=p^e otherwise. - David W. Wilson, Feb 26 2011
a(n) * A060819(n+2) = A142705(n+1) = A061037(2n+2). - Paul Curtz, Mar 02 2011
a(n) = n - (n/2)*floor(((n-1) mod 4)/3). - Gary Detlefs, Apr 14 2013
a(2^n) = A090129(n+1). - R. J. Mathar, Oct 09 2014
a(n) = n*(7 - (-1)^n - 2*cos(n*Pi/2))/8. - Federico Provvedi, Jan 02 2018
E.g.f.: (1/4)*x*(4*cosh(x) + sin(x) + 3*sinh(x)). - Stefano Spezia, Jan 26 2020
Sum_{k=1..n} a(k) ~ (7/16) * n^2. - Amiram Eldar, Nov 28 2022

A070433 a(n) = n^2 mod 9.

Original entry on oeis.org

0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1
Offset: 0

Views

Author

N. J. A. Sloane, May 12 2002

Keywords

Comments

Also decimal expansion of 4692347/333333333. - Enrique Pérez Herrero, Nov 27 2022

Crossrefs

Programs

Formula

From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-9).
G.f.: ( -x*(1+x)*(x^6+3*x^5-3*x^4+10*x^3-3*x^2+3*x+1) ) / ( (x-1)*(1+x+x^2)*(x^6+x^3+1) ). (End)
a(n) = A010878(A000290(n)) = A010878(n^2). - Enrique Pérez Herrero, Nov 27 2022

A174452 a(n) = n^2 mod 1000.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 24, 89, 156, 225, 296, 369, 444, 521, 600, 681, 764, 849, 936, 25, 116, 209, 304, 401, 500, 601, 704, 809, 916, 25
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 21 2010

Keywords

Comments

a(n) = A000290(n) for n < 32, but a(32) = 24;
A008959(n) = a(n) mod 10; A002015(n) = a(n) mod 100;
periodic with period 500: a(n+500)=a(n) and a(250*n+k)=a(250*n-k) for k <= 250*n;
a(n) = (n mod 1000)^2 mod 1000;
a(m*n) = a(m)*a(n) mod 1000;
A122986 gives the range of this sequence;
a(n) = n for n = 0, 1, and 376.

Examples

			Some calculations for n=982451653, to be realized by hand:
a(n) = (53^2 + 200*6*3) mod 1000 = 6409 mod 1000 = 409;
a(n) = (653^2) mod 1000 = 426409 mod 1000 = 409;
a(n) = a(n mod 500) = a(153) = 409;
a(n) = 965211250482432409 mod 1000 = 409.
		

Crossrefs

Programs

Formula

a(n) = ((n mod 100)^2 + 200 * (floor(n/100) mod 10) * (n mod 10)) mod 1000.

A002015 a(n) = n^2 reduced mod 100.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Periodic with period 50: (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 0, 21, 44, 69, 96, 25, 56, 89, 24, 61, 0, 41, 84, 29, 76, 25, 76, 29, 84, 41, 0, 61, 24, 89, 56, 25, 96, 69, 44, 21, 0, 81, 64, 49, 36, 25, 16, 9, 4, 1) and next term is 0. The period is symmetrical about the "midpoint" 25. - Zak Seidov, Oct 26 2009
A010461 gives the range of this sequence. - Reinhard Zumkeller, Mar 21 2010

Crossrefs

Programs

Formula

From Reinhard Zumkeller, Mar 21 2010: (Start)
a(n) = (n mod 10) * ((n mod 10) + 20 * ((n\10) mod 10)) mod 100.
a(n) = A174452(n) mod 100; A008959(n) = a(n) mod 10;
a(m*n) = a(m)*a(n) mod 100;
a(n) = (n mod 100)^2 mod 100;
a(n) = n for n = 0, 1, and 25. (End)

Extensions

Definition rephrased at the suggestion of Zak Seidov, Oct 26 2009

A034796 a(1)=1, a(n-1) is a square mod a(n), and a(n) > a(n-1).

Original entry on oeis.org

1, 2, 7, 9, 10, 13, 17, 19, 25, 26, 34, 37, 41, 43, 49, 50, 62, 67, 73, 74, 82, 87, 89, 94, 97, 99, 105, 106, 109, 113, 121, 122, 127, 129, 130, 133, 137, 139, 145, 146, 157, 162, 167, 173, 178, 181, 185, 187, 193, 194, 206, 214, 217, 218, 223, 237, 241, 243, 249
Offset: 1

Views

Author

Keywords

Comments

a(n) is the smallest number larger than a(n-1) such that a(n-1) is a quadratic residue mod a(n). - R. J. Mathar, Jul 27 2015

Examples

			For n=3 we have a(2)=2. 2 is not quadratic residue mod 3 because the quadratic residues mod 3 are {0,1}, see A011655. 2 is not a quadratic residue mod 4 because the quadratic residues mod 4 are {0,1}, see A000035. 2 is not a quadratic residue mod 5 because the quadratic residues mod 5 are {0,1,4}, see A070430. 2 is not a quadratic residue mod 6 because the quadratic residues mod 6 are {0,1,3,4}, see A070431. 2 is a quadratic residue mod 7 because the quadratic residues mod 7 are {0,1,2,4}, see A053879. So a(3)=7. - _R. J. Mathar_, Jul 27 2015
		

Programs

  • Maple
    A034796 := proc(n)
        option remember;
        if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if numtheory[quadres](procname(n-1),a) = 1 then
                    return a;
                end if;
            end do:
        end  if;
    end proc: # R. J. Mathar, Jul 27 2015
  • Mathematica
    residueQ[n_, k_] := Length[ Select[ Range[ Floor[k/2]]^2, Mod[#, k] == n &, 1]] == 1; a[1] = 1; a[n_] := a[n] = For[k = a[n-1] + 1, True, k++, If[residueQ[a[n-1], k], Return[k]]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Aug 13 2013 *)

Extensions

Clarified definition, Joerg Arndt, Aug 14 2013

A096459 Triangle read by rows: T(n,k) = n^2 mod prime(k), 1<=k<=n.

Original entry on oeis.org

1, 0, 1, 1, 0, 4, 0, 1, 1, 2, 1, 1, 0, 4, 3, 0, 0, 1, 1, 3, 10, 1, 1, 4, 0, 5, 10, 15, 0, 1, 4, 1, 9, 12, 13, 7, 1, 0, 1, 4, 4, 3, 13, 5, 12, 0, 1, 0, 2, 1, 9, 15, 5, 8, 13, 1, 1, 1, 2, 0, 4, 2, 7, 6, 5, 28, 0, 0, 4, 4, 1, 1, 8, 11, 6, 28, 20, 33, 1, 1, 4, 1, 4, 0, 16, 17, 8, 24, 14, 21, 5, 0, 1, 1, 0
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 12 2004

Keywords

Comments

T(n,k)=0 iff k is a prime factor of n:
A001221(n) = number of zeros in n-th row;
T(n,1)=A000035(n);
T(n,2)=A011655(n) for n>1; T(n,3)=A070430(n) for n>2;
T(n,4)=A053879(n) for n>3; T(n,5)=A070434(n) for n>4;
T(n,6)=A070436(n) for n>5; T(n,7)=A054580(n) for n>6;
T(n,8)=A070441(n) for n>7; T(n,9)=A070445(n) for n>8;
T(n,10)=A070451(n) for n>9;
T(n,n)=A069547(n).

Examples

			Triangle begins:
1;
0, 1;
1, 0, 4;
0, 1, 1, 2;
1, 1, 0, 4, 3;
0, 0, 1, 1, 3, 10;
1, 1, 4, 0, 5, 10, 15;
......
		

Crossrefs

Programs

  • Mathematica
    Table[Mod[n^2, Prime[k]], {n, 1, 10}, {k, 1, n}] (* G. C. Greubel, May 20 2017 *)
Showing 1-10 of 11 results. Next