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

A097062 Interleave 2*n+1 and 2*n-1.

Original entry on oeis.org

1, -1, 3, 1, 5, 3, 7, 5, 9, 7, 11, 9, 13, 11, 15, 13, 17, 15, 19, 17, 21, 19, 23, 21, 25, 23, 27, 25, 29, 27, 31, 29, 33, 31, 35, 33, 37, 35, 39, 37, 41, 39, 43, 41, 45, 43, 47, 45, 49, 47, 51, 49, 53, 51, 55, 53, 57, 55, 59, 57, 61, 59, 63, 61, 65, 63, 67, 65, 69, 67, 71, 69, 73, 71, 75, 73, 77, 75, 79, 77, 81, 79, 83, 81, 85, 83, 87, 85
Offset: 0

Views

Author

Paul Barry, Jul 22 2004

Keywords

Comments

Partial sums are A097063, whose pairwise sums are A002061.
Binomial transform is A097064.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a097062 n = a097062_list !! n
    a097062_list = concat $ transpose [a005408_list, (-1) : a005408_list]
    -- Reinhard Zumkeller, Apr 16 2015
    
  • Magma
    [(2*n-1)/2 + 3*(-1)^n/2 : n in [0..100]]; // Wesley Ivan Hurt, May 22 2021
  • Mathematica
    LinearRecurrence[{1, 1, -1}, {1, -1, 3}, 100] (* Amiram Eldar, May 21 2021 *)
    With[{nn=91},Riffle[Range[1,nn,2],Range[-1,nn-2,2]]] (* Harvey P. Dale, Jan 23 2023 *)
  • PARI
    a(n)=(2*n-1)/2+3*(-1)^n/2 \\ Charles R Greathouse IV, Oct 07 2015
    
  • PARI
    Vec((1-2*x+3*x^2)/((1-x^2)*(1-x)) + O(x^100)) \\ Altug Alkan, Nov 13 2015
    

Formula

G.f.: (1-2*x+3*x^2)/((1-x^2)*(1-x)).
a(n) = (2*n-1)/2 + 3*(-1)^n/2.
a(n) = 2*(n-1) - a(n-1), with a(0)=1. - Vincenzo Librandi, Nov 16 2010
a(n) = n - 2 + 3*((n-1) mod 2). - Lechoslaw Ratajczak, May 21 2021
a(n) = a(n-1)+a(n-2)-a(n-3). - Wesley Ivan Hurt, May 21 2021

A209293 Inverse permutation of A185180.

Original entry on oeis.org

1, 2, 3, 5, 4, 6, 8, 9, 7, 10, 13, 12, 14, 11, 15, 18, 19, 17, 20, 16, 21, 25, 24, 26, 23, 27, 22, 28, 32, 33, 31, 34, 30, 35, 29, 36, 41, 40, 42, 39, 43, 38, 44, 37, 45, 50, 51, 49, 52, 48, 53, 47, 54, 46, 55, 61, 60, 62, 59, 63, 58, 64, 57, 65, 56, 66, 72, 73, 71, 74, 70, 75, 69, 76, 68, 77, 67
Offset: 1

Views

Author

Boris Putievskiy, Jan 16 2013

Keywords

Comments

Permutation of the natural numbers. a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Enumeration table T(n,k) by diagonals. The order of the list
if n is odd - T(n-1,2),T(n-3,4),...,T(2,n-1),T(1,n),T(3,n-2),...T(n,1).
if n is even - T(n-1,2),T(n-3,4),...,T(3,n-2),T(1,n),T(2,n-1),...T(n,1).
Table T(n,k) contains:
Column number 1 A000217,
column number 2 A000124,
column number 3 A000096,
column number 4 A152948,
column number 5 A034856,
column number 6 A152950,
column number 7 A055998.
Row number 1 A000982,
row number 2 A097063.

Examples

			The start of the sequence as table:
  1....2...5...8..13..18...25...32...41...
  3....4...9..12..19..24...33...40...51...
  6....7..14..17..26..31...42...49...62...
  10..11..20..23..34..39...52...59...74...
  15..16..27..30..43..48...63...70...87...
  21..22..35..38..53..58...75...82..101...
  28..29..44..47..64..69...88...95..116...
  36..37..54..57..76..81..102..109..132...
  45..46..65..68..89..94..117..124..149...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  2,3;
  5,4,6;
  8,9,7,10;
  13,12,14,11,15;
  18,19,17,20,16,21;
  25,24,26,23,27,22,28;
  32,33,31,34,30,35,29,36;
  41,40,42,39,43,38,44,37,45;
  . . .
Row number r contains permutation from r numbers:
if r is odd  ceiling(r^2/2), ceiling(r^2/2)+1, ceiling(r^2/2)-1, ceiling(r^2/2)+2, ceiling(r^2/2)-2,...r*(r+1)/2;
if r is even ceiling(r^2/2), ceiling(r^2/2)-1, ceiling(r^2/2)+1, ceiling(r^2/2)-2, ceiling(r^2/2)+2,...r*(r+1)/2;
		

Crossrefs

Programs

  • Mathematica
    max = 10; row[n_] := Table[Ceiling[(n + k - 1)^2/2] + If[OddQ[k], 1, -1]*Floor[n/2], {k, 1, max}]; t = Table[row[n], {n, 1, max}]; Table[t[[n - k + 1, k]], {n, 1, max}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Jan 17 2013 *)
  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    m1=int((i+j)/2)+int(i/2)*(-1)**(i+t+1)
    m2=int((i+j+1)/2)+int(i/2)*(-1)**(i+t)
    m=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

As table T(n,k) read by antidiagonals
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where
m1 = int((i+j)/2)+int(i/2)*(-1)^(i+t+1),
m2 = int((i+j+1)/2)+int(i/2)*(-1)^(i+t),
t = int((math.sqrt(8*n-7) - 1)/ 2),
i = n-t*(t+1)/2,
j = (t*t+3*t+4)/2-n.

A326296 Triangle of numbers T(n,k) = 2*floor(k/2)*(n-k) + ceiling((k-1)^2/2), 1<=k<=n.

Original entry on oeis.org

0, 0, 1, 0, 3, 2, 0, 5, 4, 5, 0, 7, 6, 9, 8, 0, 9, 8, 13, 12, 13, 0, 11, 10, 17, 16, 19, 18, 0, 13, 12, 21, 20, 25, 24, 25, 0, 15, 14, 25, 24, 31, 30, 33, 32, 0, 17, 16, 29, 28, 37, 36, 41, 40, 41, 0, 19, 18, 33, 32, 43, 42, 49, 48, 51, 50, 0, 21, 20, 37, 36, 49, 48, 57, 56, 61, 60, 61
Offset: 1

Views

Author

M. Ryan Julian Jr., Sep 10 2019

Keywords

Comments

T(n,k) gives the maximum number of inversions in a permutation on n symbols containing a single k-cycle and (n-k) other fixed points.
T(n,n) = A000982(n).
T(n,n-1) = A097063(n).

Examples

			Triangle begins:
0;
0, 1;
0, 3, 2;
0, 5, 4, 5;
0, 7, 6, 9, 8;
0, 9, 8, 13, 12, 13;
0, 11, 10, 17, 16, 19, 18;
0, 13, 12, 21, 20, 25, 24, 25;
0, 15, 14, 25, 24, 31, 30, 33, 32;
0, 17, 16, 29, 28, 37, 36, 41, 40, 41;
0, 19, 18, 33, 32, 43, 42, 49, 48, 51, 50;
0, 21, 20, 37, 36, 49, 48, 57, 56, 61, 60, 61;
...
		

Crossrefs

Diagonals give A000982, A097063, A326657, A326658.
Row sums give A000330.

Programs

  • PARI
    T(n,k) = {2*floor(k/2)*(n-k) + ceil((k-1)^2/2)} \\ Andrew Howroyd, Sep 10 2019

Formula

T(n,k) = 2*floor(k/2)*(n-k) + ceiling((k-1)^2/2).
T(n,k) = 2*floor(k/2)*(n-k) + binomial(k,2) - ceiling(k/2) + 1.

A214928 A209293 as table read layer by layer clockwise.

Original entry on oeis.org

1, 2, 4, 3, 5, 9, 14, 7, 6, 8, 12, 17, 23, 20, 11, 10, 13, 19, 26, 34, 43, 30, 27, 16, 15, 18, 24, 31, 39, 48, 58, 53, 38, 35, 22, 21, 25, 33, 42, 52, 63, 75, 88, 69, 64, 47, 44, 29, 28, 32, 40, 49, 59, 70, 82, 95, 109, 102, 81, 76, 57, 54, 37, 36, 41, 51, 62
Offset: 1

Views

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). The order of the list:
T(1,1)=1;
T(1,2), T(2,2), T(2,1);
. . .
T(1,n), T(2,n), ... T(n-1,n), T(n,n), T(n,n-1), ... T(n,1);
. . .

Examples

			The start of the sequence as table:
  1....2...5...8..13..18...
  3....4...9..12..19..24...
  6....7..14..17..26..31...
  10..11..20..23..34..39...
  15..16..27..30..43..48...
  21..22..35..38..53..58...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  2,4,3;
  5,9,14,7,6;
  8,12,17,23,20,11,10;
  13,19,26,34,43,30,27,16,15;
  18,24,31,39,48,58,53,38,35,22,21;
  . . .
Row number r contains 2*r-1 numbers.
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(n-1)))+1
    i=min(t,n-(t-1)**2)
    j=min(t,t**2-n+1)
    m1=int((i+j)/2)+int(i/2)*(-1)**(2*i+j-1)
    m2=int((i+j+1)/2)+int(i/2)*(-1)**(2*i+j-2)
    result=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

As table
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n)= (m1+m2-1)*(m1+m2-2)/2+m1, where m1=floor((i+j)/2) + floor(i/2)*(-1)^(2*i+j-1), m2=int((i+j+1)/2)+int(i/2)*(-1)^(2*i+j-2), where i=min(t; n-(t-1)^2), j=min(t; t^2-n+1), t=floor(sqrt(n-1))+1.

A214929 A209293 as table read layer by layer - layer clockwise, layer counterclockwise and so on.

Original entry on oeis.org

1, 3, 4, 2, 5, 9, 14, 7, 6, 10, 11, 20, 23, 17, 12, 8, 13, 19, 26, 34, 43, 30, 27, 16, 15, 21, 22, 35, 38, 53, 58, 48, 39, 31, 24, 18, 25, 33, 42, 52, 63, 75, 88, 69, 64, 47, 44, 29, 28, 36, 37, 54, 57, 76, 81, 102, 109, 95, 82, 70, 59, 49, 40, 32, 41, 51, 62
Offset: 1

Views

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). Table read by boustrophedonic ("ox-plowing") method. Let m be natural number. The order of the list:
T(1,1)=1;
T(2,1), T(2,2), T(1,2);
. . .
T(1,2*m+1), T(2,2*m+1), ... T(2*m,2*m+1), T(2*m+1,2*m+1), T(2*m+1,2*m), ... T(2*m+1,1);
T(2*m,1), T(2*m,2), ... T(2*m,2*m-1), T(2*m,2*m), T(2*m-1,2*m), ... T(1,2*m);
. . .
The first row is layer read clockwise, the second row is layer counterclockwise.

Examples

			The start of the sequence as table:
  1....2...5...8..13..18...
  3....4...9..12..19..24...
  6....7..14..17..26..31...
  10..11..20..23..34..39...
  15..16..27..30..43..48...
  21..22..35..38..53..58...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  3,4,2;
  5,9,14,7,6;
  10,11,20,23,17,12,8;
  13,19,26,34,43,30,27,16,15;
  21,22,35,38,53,58,48,39,31,24,18;
  . . .
Row number r contains 2*r-1 numbers.
		

Crossrefs

Cf. A081344, A209293, A209279, A209278, A185180; table T(n,k) contains: in rows A000982, A097063; in columns A000217, A000124, A000096, A152948, A034856, A152950, A055998, A000982, A097063.

Programs

  • Python
    t=int((math.sqrt(n-1)))+1
    i=(t % 2)*min(t,n-(t-1)**2) + ((t+1) % 2)*min(t,t**2-n+1)
    j=(t % 2)*min(t,t**2-n+1) + ((t+1) % 2)*min(t,n-(t-1)**2)
    m1=int((i+j)/2)+int(i/2)*(-1)**(2*i+j-1)
    m2=int((i+j+1)/2)+int(i/2)*(-1)**(2*i+j-2)
    result=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

As table
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n)= (m1+m2-1)*(m1+m2-2)/2+m1, where
m1=floor((i+j)/2) + floor(i/2)*(-1)^(2*i+j-1), m2=int((i+j+1)/2)+int(i/2)*(-1)^(2*i+j-2),
where i=(t mod 2)*min(t; n-(t-1)^2) + (t+1 mod 2)*min(t; t^2-n+1), j=(t mod 2)*min(t; t^2-n+1) + (t+1 mod 2)*min(t; n-(t-1)^2), t=floor(sqrt(n-1))+1.

A146161 a(n) is the number of n X n matrices with entries in {1,2,3} such that all adjacent entries (in the same row or column) differ by 1 or -1.

Original entry on oeis.org

3, 8, 48, 512, 12288, 524288, 50331648, 8589934592, 3298534883328, 2251799813685248, 3458764513820540928, 9444732965739290427392, 58028439341502200385896448, 633825300114114700748351602688
Offset: 1

Views

Author

W. Edwin Clark, Oct 27 2008

Keywords

Comments

Let G(n) be the graph whose vertices are sequences of length n with entries in {1,2,3} for which adjacent terms differ by +-1 and {s,t} is an edge if the i-th term of sequence s differs from the i-th term of sequence t by +-1. Let A be the adjacency matrix of this graph. Then a(n) is the sum of the entries in A^(n-1). That is, a(n) is the number of paths of length n-1 in the graph G(n). Conjecture: a(n) = 2^A097063(n) for n even and 2*2^A097063(n) if n is odd.
Proof that a(n) = 2^A097063(n) for n even and 2*2^A097063(n) if n is odd, by Max Alekseyev: Suppose that elements of the n X n matrix are colored in black and white like a chessboard. Then either all black or all white elements must equal 2. Each element of the other color can be 1 or 3 independently. For even n, the number of black and white elements is the same and equal n/2. For odd n, the number of black/white squares differs by 1. Therefore the number of n X n matrices defined in A146161 is 2*2^(n^2/2)=2^((n^2+2)/2) if n is even, and 2^((n^2+1)/2) + 2^((n^2-1)/2) = 3*2^((n^2-1)/2) if n is odd. The explicit formula for A097063 gives A097063(n) = (n^2+2)/2 for even n, and A097063(n) = (n^2-1)/2 for odd n. So the conjecture is true.

Examples

			The a(2)=8 2 X 2 matrices with the desired property are {[[1, 2], [2, 1]], [[1, 2], [2, 3]], [[2, 1], [1, 2]], [[2, 1], [3, 2]], [[2, 3], [1, 2]], [[2, 3], [3, 2]], [[3, 2], [2, 1]], [[3, 2], [2, 3]]}. Here a matrix is represented as a list of its rows.
		

Formula

a(n) = 2^((n^2+2)/2) if n is even, and 3*2^((n^2-1)/2) if n is odd.

Extensions

Extended by Max Alekseyev, Mar 23 2009

A215006 a(0)=0, a(n+1) is the least k>a(n) such that k+a(n)+n+1 is a Fibonacci number.

Original entry on oeis.org

0, 1, 2, 3, 6, 10, 18, 30, 51, 84, 139, 227, 371, 603, 980, 1589, 2576, 4172, 6756, 10936, 17701, 28646, 46357, 75013, 121381, 196405, 317798, 514215, 832026, 1346254, 2178294, 3524562, 5702871, 9227448, 14930335, 24157799, 39088151, 63245967, 102334136, 165580121
Offset: 0

Views

Author

Alex Ratushnyak, Jul 31 2012

Keywords

Comments

Same definition for k:
k+b(n)+n is a square for each term b(n) of A097063 except the first;
k+b(n)+n+1 is a square for each term b(n) of A007590 except the first;
k+b(n)+n is a cube for each term b(n) of the sequence 0, 7, 18, 43, 78, 133, 204, 301, 420, 571, 750, 967, 1218, 1513, 1848, 2233, 2664, 3151, 3690, 4291, 4950, 5677, 6468, 7333, ... (last digit repeats with period 10);
k+b(n)+n is a triangular number for each term b(n) of A002378 (oblong numbers);
k+b(n)+n is an oblong number for each term b(n) of A000217 (triangular numbers);
k+b(n)+n is a prime for each term b(n) of the sequence 0, 1, 2, 6, 7, 11, 12, 18, 21, 23, 26, 30, 31, 35, 40, 42, 43, 47, 48, 60, 69, 73, 78, 80, 87, 99, 102, 104, 107, 115, 118, 120, 125, 135, ...

Examples

			For n + 1 = 7, a(n + 1) = 30 is the least k > a(n) = a(6) = 18 such that k + a(n) + n + 1 = 30 + 18 + 6 + 1 = 55 is a Fibonacci number. - _David A. Corneth_, Sep 03 2016
		

Crossrefs

Programs

  • Magma
    [n le 3 select n else Self(n)+Self(n-1)+Floor(n/2)-1: n in [0..40]]; // Bruno Berselli, Jul 31 2012
  • Mathematica
    Join[{0}, LinearRecurrence[{2, 1, -3, 0, 1}, {1, 2, 3, 6, 10}, 39]] (* Jean-François Alcover, Oct 05 2017 *)
  • Python
    prpr = 0
    prev = 1
    fib = [0]*100
    for n in range(100):
        fib[n] = prpr
        curr = prpr+prev
        prpr = prev
        prev = curr
    a = 0
    for n in range(1,55):
        print(a, end=',')
        b = c = 0
        while c <= a:
            c = fib[b] - a - n
            b += 1
        a=c
    
  • Python
    print(0, end=',')
    prpr = 1
    prev = 2
    for n in range(3,56):
        print(prpr, end=',')
        curr = prpr+prev + n//2 - 1
        prpr = prev
        prev = curr
    

Formula

a(n) = a(n-1) +a(n-2) +floor(n/2) -1 with n>1, a(0)=0, a(1)=1.
From Bruno Berselli, Jul 31 2012: (Start)
G.f.: x*(1-2*x^2+x^3+x^4)/((1+x)*(1-x)^2*(1-x-x^2)).
a(n) = Fibonacci(n+2)-A004526(n+1) with n>0, a(0)=0.
a(n) = A129696(n-1)+1 with n>1, a(0)=0, a(1)=1. (End)

Extensions

Definition corrected by David A. Corneth, Sep 03 2016
Showing 1-7 of 7 results.