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.

Previous Showing 11-15 of 15 results.

A106831 Define a triangle in which the entries are of the form +-1/(b!c!d!e!...), where the order of the factorials is important; read the triangle by rows and record and expand the denominators.

Original entry on oeis.org

2, 6, 4, 24, 12, 12, 8, 120, 48, 36, 24, 48, 24, 24, 16, 720, 240, 144, 96, 144, 72, 72, 48, 240, 96, 72, 48, 96, 48, 48, 32, 5040, 1440, 720, 480, 576, 288, 288, 192, 720, 288, 216, 144, 288, 144, 144, 96, 1440, 480, 288, 192, 288, 144, 144, 96, 480, 192, 144, 96, 192
Offset: 0

Views

Author

N. J. A. Sloane, May 22 2005

Keywords

Comments

Row n has 2^n terms. Row 0 is +1/2!. An entry +-1/b!c!d!... has two children, a left child -+1/(a+1)!b!c!... and a right child +-1/2!b!c!d!...
Let S_n = sum of entries in row n of the triangle. Then for n > 0, n!S_{n-1} is the Bernoulli number B_n.

Examples

			Woon's "Bernoulli Tree" begins like this (see also the given Wikipedia-link). This sequence gives the values of the denominators:
                                     +1
                                    ────
                                     2!
                 -1                 /  \                  +1
                ──── ............../    \.............. ─────
                 3!                                      2!2!
        +1        .         -1                 -1         .         +1
       ────      / \       ────               ────       / \      ──────
        4! ...../   \..... 2!3!               3!2! ...../   \.... 2!2!2!
       / \                 / \                 / \                 / \
      /   \               /   \               /   \               /   \
     /     \             /     \             /     \             /     \
    -1      +1         +1       -1         +1      -1          -1       +1
   ────    ────       ────     ──────     ────   ──────      ──────  ────────
    5!     2!4!       3!3!     2!2!3!     4!2!   2!3!2!      3!2!2!  2!2!2!2!
etc.
		

Crossrefs

Cf. A242179 (numerators), A050925, A050932, A000142.
Cf. A323505 (mirror image), and also A005940, A283477, A322827 for other similar trees.

Programs

  • Haskell
    a106831 n k = a106831_tabf !! n !! n
    a106831_row n = a106831_tabf !! n
    a106831_tabf = map (map (\(, , left, right) -> left * right)) $
       iterate (concatMap (\(x, f, left, right) -> let f' = f * x in
       [(x + 1, f', f', right), (3, 2, 2, left * right)])) [(3, 2, 2, 1)]
    -- Reinhard Zumkeller, May 05 2014
    
  • Maple
    Contribution from Peter Luschny, Jun 12 2009: (Start)
    The routine computes the triangle row by row and gives the numbers with their sign.
    Thus A(1)=[2]; A(2)=[ -6,4]; A(3)=[24,-12,-12,8]; etc.
    A := proc(n) local k, i, j, m, W, T; k := 2;
    W := array(0..2^n); W[1] := [1,`if`(n=0,1,2)];
    for i from 1 to n-1 do for m from k by 2 to 2*k-1 do
    T := W[iquo(m,2)]; W[m] := [ -T[1],T[2]+1,seq(T[j],j=3..nops(T))];
    W[m+1] := [T[1],2,seq(T[j],j=2..nops(T))]; od; k := 2*k; od;
    seq(W[i][1]*mul(W[i][j]!,j=2..nops(W[i])),i=iquo(k,2)..k-1) end:
    seq(print(A(i)),i=1..5); (End)
  • Mathematica
    a [n_] := Module[{k, i, j, m, w, t}, k = 2; w = Array[0&, 2^n]; w[[1]] := {1, If[n == 0, 1, 2]}; For[i = 1, i <= n-1, i++, For[m = k, m <= 2*k-1 , m = m+2, t = w[[Quotient[m, 2]]]; w[[m]] = {-t[[1]], t[[2]]+1, Sequence @@ Table[t[[j]], {j, 3, Length[t]}]}; w[[m+1]] = {t[[1]], 2, Sequence @@ Table[t[[j]], {j, 2, Length[t]}]}]; k = 2*k]; Table[w[[i, 1]]*Product[w[[i, j]]!, {j, 2, Length[w[[i]]]}], {i, Quotient[k, 2], k-1}]]; Table[a[i] , {i, 1, 6}] // Flatten // Abs (* Jean-François Alcover, Dec 20 2013, translated from Maple *)
  • PARI
    A106831off1(n) = if(!n,1, my(rl=1, m=1); while(n,if(!(n%2), rl++, m *= ((1+rl)!); rl=1); n >>= 1); (m));
    A106831(n) = A106831off1(1+n); \\ Antti Karttunen, Jan 16 2019
    
  • PARI
    A001511(n) = (1+valuation(n,2));
    A106831r1(n) = if(!n,1,if(n%2, 2*A106831r1((n-1)/2), (1+A001511(n))*A106831r1(n/2))); \\ Implements the given recurrence.
    A106831(n) = A106831r1(1+n); \\ Antti Karttunen, Jan 16 2019

Formula

From Antti Karttunen, Jan 16 2019: (Start)
If sequence is shifted one term to the right, then the following recurrence works:
a(0) = 1; and for n > 0, a(2n) = (1+A001511(2n))*a(n), a(2n+1) = 2*a(n).
(End)

Extensions

More terms from Franklin T. Adams-Watters, Apr 28 2006
Example section reillustrated by Antti Karttunen, Jan 16 2019

A246661 Run Length Transform of swinging factorials (A056040).

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 6, 1, 1, 1, 2, 1, 1, 2, 6, 2, 2, 2, 4, 6, 6, 6, 30, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 6, 2, 2, 2, 4, 2, 2, 4, 12, 6, 6, 6, 12, 6, 6, 30, 20, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 6, 1, 1, 1, 2, 1, 1
Offset: 0

Views

Author

Peter Luschny, Sep 07 2014

Keywords

Comments

For the definition of the Run Length Transform see A246595.

Crossrefs

Programs

  • Mathematica
    f[n_] := n!/Quotient[n, 2]!^2; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 85}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    # use RLT function from A278159
    from math import factorial
    def A246661(n): return RLT(n,lambda m: factorial(m)//factorial(m//2)**2) # Chai Wah Wu, Feb 04 2022
  • Sage
    # uses[RLT from A246660]
    A246661_list = lambda len: RLT(lambda n: factorial(n)/factorial(n//2)^2, len)
    A246661_list(88)
    

Formula

a(2^n-1) = n$ where n$ is the swinging factorial of n, A056040(n).

A323505 Mirror image of (denominators of) Bernoulli tree, A106831.

Original entry on oeis.org

1, 2, 4, 6, 8, 12, 12, 24, 16, 24, 24, 48, 24, 36, 48, 120, 32, 48, 48, 96, 48, 72, 96, 240, 48, 72, 72, 144, 96, 144, 240, 720, 64, 96, 96, 192, 96, 144, 192, 480, 96, 144, 144, 288, 192, 288, 480, 1440, 96, 144, 144, 288, 144, 216, 288, 720, 192, 288, 288, 576, 480, 720, 1440, 5040, 128, 192, 192, 384, 192, 288, 384, 960, 192, 288, 288
Offset: 0

Views

Author

Antti Karttunen, Jan 16 2019

Keywords

Comments

In contrast to A106831 which follows Woon's original indexing (and orientation), this variant starts with value a(0) = 1, with the rest of terms having an index incremented by one, thus allowing for a simple recurrence.
Sequence contains only terms of A001013 and each a(n) is a multiple of A246660(n).

Examples

			This sequence can be represented as a binary tree:
                                       1
                                       |
                    ...................2....................
                   4                                        6
         8......../ \........12                 12........./ \.......24
        / \                 / \                 / \                 / \
       /   \               /   \               /   \               /   \
      /     \             /     \             /     \             /     \
    16       24         24       48         24       36         48      120
  32  48   48  96     48  72   96  240    48  72   72  144    96  144 240  720
etc.
		

Crossrefs

Cf. A000079 (left edge), A000142 (right edge), A001013, A001511, A036987, A054429, A246660, A323506, A323508.
Cf. A106831 and also A005940, A283477, A322827 for other similar trees.

Programs

Formula

a(0) = 1; and for n > 0, if n is even, a(n) = 2*a(n/2), and if n is odd, a(n) = (A001511(n+1)+1-A036987(n)) * a((n-1)/2).
For n > 0, a(n) = b(A054429(n)), where b(n) = A106831(n-1).
a(n) = A246660(n) * A323506(n).
a(n) = A323508(A005940(1+n)).

A247282 Run Length Transform of A001317.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 15, 1, 1, 1, 3, 1, 1, 3, 5, 3, 3, 3, 9, 5, 5, 15, 17, 1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 15, 3, 3, 3, 9, 3, 3, 9, 15, 5, 5, 5, 15, 15, 15, 17, 51, 1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 15, 1, 1, 1, 3, 1, 1, 3, 5, 3, 3, 3, 9, 5, 5, 15, 17, 3, 3, 3, 9, 3, 3, 9, 15, 3, 3, 3, 9, 9, 9, 15, 45
Offset: 0

Views

Author

Antti Karttunen, Sep 22 2014

Keywords

Comments

The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g. 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).
This sequence is obtained by applying Run Length Transform to the right-shifted version of the sequence A001317: 1, 3, 5, 15, 17, 51, 85, 255, 257, ...

Examples

			115 is '1110011' in binary. The run lengths of 1-runs are 2 and 3, thus a(115) = A001317(2-1) * A001317(3-1) = 3*5 = 15.
From _Omar E. Pol_, Feb 15 2015: (Start)
Written as an irregular triangle in which row lengths are the terms of A011782:
1;
1;
1,3;
1,1,3,5;
1,1,1,3,3,3,5,15;
1,1,1,3,1,1,3,5,3,3,3,9,5,5,15,17;
1,1,1,3,1,1,3,5,1,1,1,3,3,3,5,15,3,3,3,9,3,3,9,15,5,5,5,15,15,15,17,51;
...
Right border gives 1 together with A001317.
(End)
		

Crossrefs

Cf. A003714 (gives the positions of ones).
A001316 is obtained when the same transformation is applied to A000079, the powers of two.
Run Length Transforms of other sequences: A071053, A227349, A246588, A246595, A246596, A246660, A246661, A246674, A246685.

Programs

  • Mathematica
    a1317[n_] := FromDigits[ Table[ Mod[Binomial[n-1, k], 2], {k, 0, n-1}], 2];
    Table[ Times @@ (a1317[Length[#]]&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 100}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    # uses RLT function from A278159
    def A247282(n): return RLT(n,lambda m: int(''.join(str(int(not(~(m-1)&k))) for k in range(m)),2)) # Chai Wah Wu, Feb 04 2022

Formula

For all n >= 0, a(A051179(n)) = A246674(A051179(n)) = A051179(n).

A246685 Run Length Transform of sequence 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers).

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 17, 1, 1, 1, 3, 1, 1, 3, 5, 3, 3, 3, 9, 5, 5, 17, 257, 1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 17, 3, 3, 3, 9, 3, 3, 9, 15, 5, 5, 5, 15, 17, 17, 257, 65537, 1, 1, 1, 3, 1, 1, 3, 5, 1, 1, 1, 3, 3, 3, 5, 17, 1, 1, 1, 3, 1, 1, 3, 5, 3, 3, 3, 9, 5, 5, 17, 257
Offset: 0

Views

Author

Antti Karttunen, Sep 22 2014

Keywords

Comments

The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g. 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).
This sequence is obtained by applying Run Length Transform to sequence b = 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers, with b(1) = 1, b(2) = 3, b(3) = 5, ..., b(n) = 2^(2^(n-2)) + 1 for n >= 2).

Examples

			115 is '1110011' in binary. The run lengths of 1-runs are 2 and 3, thus we multiply the second and the third elements of the sequence 1, 3, 5, 17, 257, 65537, ... to get a(115) = 3*5 = 15.
		

Crossrefs

Cf. A003714 (gives the positions of ones).
Cf. A000215.
A001316 is obtained when the same transformation is applied to A000079, the powers of two. Cf. also A001317.
Run Length Transforms of other sequences: A071053, A227349, A246588, A246595, A246596, A246660, A246661, A246674, A247282.

Programs

Previous Showing 11-15 of 15 results.