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.

A246705 Position of first n in A246694 (read as sequence with offset changed to 1); complement of A246706.

Original entry on oeis.org

1, 3, 4, 6, 8, 10, 11, 13, 15, 17, 19, 21, 22, 24, 26, 28, 30, 32, 34, 36, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 106, 108, 110, 112, 114, 116, 118
Offset: 1

Views

Author

Clark Kimberling, Sep 02 2014

Keywords

Examples

			A246694 begins with 1, 1, 2, 3, 2, 4, 3, 5, 4, 6, 7, 5, 8, 6, 9, 7, so that, for a(n) = position of first n and b(n) = position of last n, we have a = (1,3,4,6,8,10,...) and b = (2,5,7,9,12,...).
Note, however, that A246694 has offset 0, so the values here are off by 1 from the positions as given by the indices (b-file or list) in that sequence. - _M. F. Hasler_, Nov 17 2014
		

Crossrefs

Programs

  • Mathematica
    z = 25; t[0, 0] = 1; t[1, 0] = 1; t[1, 1] = 2;
    t[n_, 0] := If[OddQ[n], t[n - 1, n - 2] + 1, t[n - 1, n - 1] + 1];
    t[n_, 1] := If[OddQ[n], t[n - 1, n - 1] + 1, t[n - 1, n - 2] + 1];
    t[n_, k_] := t[n, k - 2] + 1;
    u = Flatten[Table[t[n, k], {n, 0, z}, {k, 0, n}]]; (*A246694*)
    w[n_] := Flatten[Position[u, n]]; A246705 = Table[First[w[n]], {n, 1, 3*z}]

A128174 Transform, (1,0,1,...) in every column.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Feb 17 2007

Keywords

Comments

Inverse of the triangle = a tridiagonal matrix with (1,1,1,...) in the superdiagonal, (0,0,0,...) in the main diagonal and (-1,-1,-1,...) in the subdiagonal.
Riordan array (1/(1-x^2), x) with inverse (1-x^2,x). - Paul Barry, Sep 10 2008
The position of 1's in this sequence is equivalent to A246705, and the position of 0's is equivalent to A246706. - Bernard Schott, Jun 05 2019

Examples

			First few rows of the triangle are:
  1;
  0, 1;
  1, 0, 1;
  0, 1, 0, 1;
  1, 0, 1, 0, 1; ...
		

Crossrefs

Cf. A004526 (row sums).

Programs

  • Haskell
    a128174 n k = a128174_tabl !! (n-1) !! (k-1)
    a128174_row n = a128174_tabl !! (n-1)
    a128174_tabl = iterate (\xs@(x:_) -> (1 - x) : xs) [1]
    -- Reinhard Zumkeller, Aug 01 2014
    
  • Magma
    [[(1+(-1)^(n-k))/2: k in [1..n]]: n in [1..12]]; // G. C. Greubel, Jun 05 2019
    
  • Maple
    A128174 := proc(n,k)
        if k > n or k < 1 then
            0;
        else
            modp(k+n+1,2) ;
        end if;
    end proc: # R. J. Mathar, Aug 06 2016
  • Mathematica
    a128174[r_] := Table[If[EvenQ[n+k], 1, 0], {n, 1, r}, {k, 1, n}]
    TableForm[a128174[5]] (* triangle *)
    Flatten[a128174[10]] (* data *) (* Hartmut F. W. Hoft, Mar 15 2017 *)
    Table[(1+(-1)^(n-k))/2, {n,1,12}, {k,1,n}]//Flatten (* G. C. Greubel, Sep 26 2017 *)
  • PARI
    for(n=1,12, for(k=1,n, print1((1+(-1)^(n-k))/2, ", "))) \\ G. C. Greubel, Sep 26 2017
    
  • Sage
    [[(1+(-1)^(n-k))/2 for k in (1..n)] for n in (1..12)] # G. C. Greubel, Jun 05 2019

Formula

A lower triangular matrix transform, (1, 0, 1, ...) in every column; n terms of (1, 0, 1, ...) in odd rows; n terms of (0, 1, 0, ...) in even rows.
T(n,k) = [k<=n]*(1+(-1)^(n-k))/2. - Paul Barry, Sep 10 2008
With offset n=1, k=0: Sum_{k=0..n} {T(n,k)*x^k} = A000035(n), A004526(n+1), A000975(n), A033113(n), A033114(n), A033115(n), A033116(n), A033117(n), A033118(n), A033119(n), A056830(n+1) for x=0,1,2,3,4,5,6,7,8,9,10 respectively. - Philippe Deléham, Oct 17 2011
T(n+1,1) = 1 - T(n,1); T(n+1,k) = T(n,k-1), 1 < k <= n+1. - Reinhard Zumkeller, Aug 01 2014

A246694 Triangle read by rows: T(n,k) = T(n,k-2) + 1 if n > 1 and 2 <= k <= n; T(0,0) = 1, T(1,0) = 1, T(1,1) = 2; if n > 1 is odd, then T(n,0) = T(n-1,n-2) + 1 and T(n,1) = T(n-1,n-1) + 1; if n > 1 is even, then T(n,0) = T(n-1,n-1) + 1 and T(n,1) = T(n-1,n-2) + 1.

Original entry on oeis.org

1, 1, 2, 3, 2, 4, 3, 5, 4, 6, 7, 5, 8, 6, 9, 7, 10, 8, 11, 9, 12, 13, 10, 14, 11, 15, 12, 16, 13, 17, 14, 18, 15, 19, 16, 20, 21, 17, 22, 18, 23, 19, 24, 20, 25, 21, 26, 22, 27, 23, 28, 24, 29, 25, 30, 31, 26, 32, 27, 33, 28, 34, 29, 35, 30, 36, 31, 37, 32
Offset: 0

Views

Author

Clark Kimberling, Sep 01 2014

Keywords

Comments

As an array, for each m, row 2*m has m odd numbers and m+1 even numbers; row 2*m-1 has m odds and m evens. As a sequence, every positive integer n occurs exactly twice, separated by floor((n+1)/2) other numbers.

Examples

			First 8 rows:
  1
  1 ... 2
  3 ... 2 ... 4
  3 ... 5 ... 4 ... 6
  7 ... 5 ... 8 ... 6 ... 9
  7 .. 10 ... 8 .. 11 ... 9 .. 12
 13 .. 10 .. 14 .. 11 .. 15 .. 12 .. 16
 13 .. 17 .. 14 .. 18 .. 15 .. 19 .. 16 .. 20
		

Crossrefs

Cf. A246695 (row sums), A174114 (central terms).
Cf. A002620 (main diagonal and first subdiagonal), A377802.

Programs

  • Haskell
    a246694 n k = a246694_tabl !! n !! k
    a246694_row n = a246694_tabl !! n
    a246694_tabl = [1] : [1,2] : f 1 2 [1,2] where
       f i z xs = ys : f j (z + 1) ys where
         ys = take (z + 1) $ map (+ 1) (xs !! (z - i) : xs !! (z - j) : ys)
         j = 3 - i
    -- Reinhard Zumkeller, Sep 03 2014
  • Mathematica
    z = 25; t[0, 0] = 1; t[1, 0] = 1; t[1, 1] = 2;
    t[n_, 0] := If[OddQ[n], t[n - 1, n - 2] + 1, t[n - 1, n - 1] + 1];
    t[n_, 1] := If[OddQ[n], t[n - 1, n - 1] + 1, t[n - 1, n - 2] + 1];
    t[n_, k_] := t[n, k - 2] + 1; Flatten[Table[t[n, k], {n, 0, z}, {k, 0, n}]](*A246694*)

Formula

T(n, k) = 1 + floor(n/2) * (1+(-1)^k) / 2 + (floor(n/2))^2 + (2*k - 1 + (-1)^k) / 4 + (1-(-1)^n) * (1-(-1)^k) * n / 4. - Werner Schulte, Nov 16 2024
From Stefano Spezia, Nov 17 2024: (Start)
T(n, k) = (6 + (-1)^k + (-1)^(k+n) + 4*k + 2*n*(1 + (-1)^(k+n) + n))/8.
G.f.: (1 - x^3*y + x^7*y^3 + x^4*(1 - 2*y^2) - x^5*y*(1 - y^2))/((1 - x)^3*(1 + x)^2*(1 - x*y)^3*(1 + x*y)). (End)

Extensions

Edited by M. F. Hasler, Nov 17 2014

A246695 Row sums of the triangular array A246694.

Original entry on oeis.org

1, 3, 9, 18, 35, 57, 91, 132, 189, 255, 341, 438, 559, 693, 855, 1032, 1241, 1467, 1729, 2010, 2331, 2673, 3059, 3468, 3925, 4407, 4941, 5502, 6119, 6765, 7471, 8208, 9009, 9843, 10745, 11682, 12691, 13737, 14859, 16020, 17261, 18543, 19909, 21318, 22815
Offset: 0

Views

Author

Clark Kimberling, Sep 01 2014

Keywords

Comments

Also partial sums of A257083. - Reinhard Zumkeller, Apr 17 2015

Examples

			First 5 rows of A246694 preceded by sums
sum = 1: ...... 1
sum = 3: ...... 1 ... 2
sum = 9: ...... 3 ... 2 ... 4
sum = 18: ..... 3 ... 5 ... 4 ... 6
sum = 35: ..... 7 ... 5 ... 8 ... 6 ... 9
		

Crossrefs

Programs

  • Haskell
    a246695 n = a246695_list !! n
    a246695_list = scanl1 (+) a257083_list
    -- Reinhard Zumkeller, Apr 17 2015
  • Mathematica
    z = 25; t[0, 0] = 1; t[1, 0] = 1; t[1, 1] = 2;
    t[n_, 0] := If[OddQ[n], t[n - 1, n - 2] + 1, t[n - 1, n - 1] + 1];
    t[n_, 1] := If[OddQ[n], t[n - 1, n - 1] + 1, t[n - 1, n - 2] + 1];
    t[n_, k_] := t[n, k - 2] + 1; A246695 = Table[Sum[t[n, k], {k, 0, n}], {n, 0, z}]

Formula

Conjectured linear recurrence: a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6), with a(0) = 1, a(1) = 3, a(2) = 9, a(3) = 18, a(4) = 35, a(5) = 57, a(6) = 91.
Conjectured g.f.: (1 + x + 2*x^2 + x^3 + x^4)/((x - 1)^4*(x + 1)^2).
Conjecture: a(n) = (1/8)*(n + 1)*((-1)^n + 2*n^2 + 4*n + 7). - Eric Simon Jacob, Jul 19 2023 [This conjecture is correct; compare A377802, note offset 1. - Werner Schulte, Nov 22 2024]

Extensions

Corrected and edited by M. F. Hasler, Nov 17 2014
Showing 1-4 of 4 results.