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-4 of 4 results.

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

A123684 Alternate A016777(n) with A000027(n).

Original entry on oeis.org

1, 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, 34, 103, 35, 106, 36
Offset: 1

Views

Author

Alford Arnold, Oct 11 2006

Keywords

Comments

a(n) is a diagonal of Table A123685.
The arithmetic average of the first n terms gives the positive integers repeated (A008619). - Philippe Deléham, Nov 20 2013
Images under the modified '3x-1' map: a(n) = n/2 if n is even, (3n-1)/2 if n is odd. (In this sequence, the numbers at even indices n are n/2 [A000027], and the numbers at odd indices n are 3((n-1)/2) + 1 [A016777] = (3n-1)/2.) The latter correspondence interestingly mirrors an insight in David Bařina's 2020 paper (see below), namely that 3(n+1)/2 - 1 = (3n+1)/2. - Kevin Ge, Oct 30 2024

Examples

			The natural numbers begin 1, 2, 3, ... (A000027), the sequence 3*n + 1 begins 1, 4, 7, 10, ... (A016777), therefore A123684 begins 1, 1, 4, 2, 7, 3, 10, ...
1/1 = 1, (1+1)/2 = 1, (1+1+4)/3 = 2, (1+1+4+2)/4 = 2, ... - _Philippe Deléham_, Nov 20 2013
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a123684 n = a123684_list !! (n-1)
    a123684_list = concat $ transpose [a016777_list, a000027_list]
    -- Reinhard Zumkeller, Apr 29 2013
    
  • Magma
    &cat[ [ 3*n-2, n ]: n in [1..36] ]; // Klaus Brockhaus, May 12 2007
    
  • Magma
    /* From the fourteenth formula: */ [&+[1+k*(-1)^k: k in [0..n]]: n in [0..80]]; // Bruno Berselli, Jul 16 2013
    
  • Maple
    A123684:=n->n-1/4-(1/2*n-1/4)*(-1)^n: seq(A123684(n), n=1..70); # Wesley Ivan Hurt, Jul 26 2014
  • Mathematica
    CoefficientList[Series[(1 +x +2*x^2)/((1-x)^2*(1+x)^2), {x,0,70}], x] (* Wesley Ivan Hurt, Jul 26 2014 *)
    LinearRecurrence[{0,2,0,-1},{1,1,4,2},80] (* Harvey P. Dale, Apr 14 2025 *)
  • PARI
    print(vector(72, n, if(n%2==0, n/2, (3*n-1)/2))) \\ Klaus Brockhaus, May 12 2007
    
  • PARI
    print(vector(72, n, n-1/4-(1/2*n-1/4)*(-1)^n)); \\ Klaus Brockhaus, May 12 2007
    
  • SageMath
    [(n + (2*n-1)*(n%2))//2 for n in range(1,71)] # G. C. Greubel, Mar 15 2024

Formula

From Klaus Brockhaus, May 12 2007: (Start)
G.f.: x*(1+x+2*x^2)/((1-x)^2*(1+x)^2).
a(n) = (1/4)*(4*n - 1 - (2*n - 1)*(-1)^n).
a(2n-1) = A016777(n-1) = 3(n-1) + 1.
a(2n) = A000027(n) = n.
a(n) = A071045(n-1) + 1.
a(n) = A093005(n) - A093005(n-1) for n > 1.
a(n) = A105638(n+2) - A105638(n+1) for n > 1.
a(n) = A092530(n) - A092530(n-1) - 1.
a(n) = A031878(n+1) - A031878(n) - 1. (End)
a(2*n+1) + a(2*n+2) = A016825(n). - Paul Curtz, Mar 09 2011
a(n)= 2*a(n-2) - a(n-4). - Paul Curtz, Mar 09 2011
From Jaroslav Krizek, Mar 22 2011 (Start):
a(n) = n + a(n-1) for odd n; a(n) = n - A064455(n-1) for even n.
a(n) = A064455(n) - A137501(n).
Abs(a(n) - A064455(n)) = A052928(n). (End)
a(n) = A225126(n) for n > 1. - Reinhard Zumkeller, Apr 29 2013
a(n) = Sum_{k=1..n} (1 + (k-1)*(-1)^(k-1)). - Bruno Berselli, Jul 16 2013
a(n) = n + floor(n/2) for odd n; a(n) = n/2 for even n. - Reinhard Muehlfeld, Jul 25 2014

Extensions

More terms from Klaus Brockhaus, May 12 2007

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

A226782 If n == 0 (mod 2) then a(n) = 0, otherwise a(n) = 4^(-1) in Z/nZ*.

Original entry on oeis.org

0, 0, 1, 0, 4, 0, 2, 0, 7, 0, 3, 0, 10, 0, 4, 0, 13, 0, 5, 0, 16, 0, 6, 0, 19, 0, 7, 0, 22, 0, 8, 0, 25, 0, 9, 0, 28, 0, 10, 0, 31, 0, 11, 0, 34, 0, 12, 0, 37, 0, 13, 0, 40, 0, 14, 0, 43, 0, 15, 0, 46, 0, 16, 0, 49, 0, 17
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    A226782 := proc(n)
        local x ,a,m;
        a := 4 ;
        m := 2 ;
        if n mod m = 0 or n = 1 then
            0;
        else
            msolve(x*a=1,n) ;
            op(%) ;
            op(2,%) ;
        end if;
    end proc: # R. J. Mathar, Jun 28 2013
  • Mathematica
    Inv[a_, mod_] := Which[mod == 1, 0, GCD[a, mod] > 1, 0, True, Last@Reduce[a*x == 1, x, Modulus -> mod]]; Table[Inv[4, n], {n, 1, 122}]
    (* Second program: *)
    Table[If[EvenQ[n], 0, ModularInverse[4, n], 0], {n, 1, 100}] (* Jean-François Alcover, Mar 14 2023 *)
  • PARI
    a(n)=if(n%2,lift(Mod(1, n)/4),0) \\ Charles R Greathouse IV, Jun 18 2013

Formula

From Colin Barker, Jun 20 2013: (Start)
G.f.: -x^3*(x^6 - 4*x^2 - 1) / ( (x-1)^2*(1+x)^2*(x^2+1)^2 ).
a(2n+1) = A225126(n+1). (End)
Showing 1-4 of 4 results.