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 21-30 of 61 results. Next

A209723 1/4 the number of (n+1) X 5 0..2 arrays with every 2 X 2 subblock having distinct clockwise edge differences.

Original entry on oeis.org

6, 7, 8, 10, 12, 16, 20, 28, 36, 52, 68, 100, 132, 196, 260, 388, 516, 772, 1028, 1540, 2052, 3076, 4100, 6148, 8196, 12292, 16388, 24580, 32772, 49156, 65540, 98308, 131076, 196612, 262148, 393220, 524292, 786436, 1048580, 1572868, 2097156
Offset: 1

Views

Author

R. H. Hardin, Mar 12 2012

Keywords

Comments

Column 4 of A209727.

Examples

			Some solutions for n=4:
..2..1..2..0..2....0..2..0..1..0....0..1..0..1..0....0..1..0..1..0
..0..2..0..1..0....2..1..2..0..2....2..0..2..0..2....2..0..2..0..2
..2..1..2..0..2....0..2..0..1..0....0..1..0..1..0....0..1..0..1..0
..0..2..0..1..0....2..1..2..0..2....2..0..2..0..2....2..0..2..0..2
..2..1..2..0..2....0..2..0..1..0....1..2..1..2..1....0..1..0..1..0
		

Crossrefs

Cf. A209727.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Formula

Empirical: a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3).
Conjectures from Colin Barker, Jul 12 2018: (Start)
G.f.: x*(6 + x - 11*x^2) / ((1 - x)*(1 - 2*x^2)).
a(n) = 3*2^(n/2 - 1) + 4 for n even.
a(n) = 2^((n + 1)/2) + 4 for n odd.
(End)

A320770 a(n) = (-1)^floor(n/4) * 2^floor(n/2).

Original entry on oeis.org

1, 1, 2, 2, -4, -4, -8, -8, 16, 16, 32, 32, -64, -64, -128, -128, 256, 256, 512, 512, -1024, -1024, -2048, -2048, 4096, 4096, 8192, 8192, -16384, -16384, -32768, -32768, 65536, 65536, 131072, 131072, -262144, -262144, -524288, -524288, 1048576, 1048576
Offset: 0

Views

Author

Michael Somos, Oct 20 2018

Keywords

Examples

			G.f. = 1 + x + 2*x^2 + 2*x^3 - 4*x^4 - 4*x^5 - 8*x^6 - 8*x^7 + ...
		

Crossrefs

Cf. A016116.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Programs

  • Magma
    [(-1)^Floor(n/4)* 2^Floor(n/2): n in [0..50]]; // G. C. Greubel, Oct 27 2018
    
  • Mathematica
    a[ n_] := (-1)^Quotient[n, 4] * 2^Quotient[n, 2];
  • PARI
    {a(n) = (-1)^floor(n/4) * 2^floor(n/2)};
    
  • Python
    def A320770(n): return -(1<<(n>>1)) if n&4 else 1<<(n>>1) # Chai Wah Wu, Jan 18 2023

Formula

G.f.: (1 + x) * (1 + 2*x^2) / (1 + 4*x^4).
G.f.: A(x) = 1/(1 - x/(1 - x/(1 + 2*x/(1 - 4*x/(1 + 3*x/(1 + 5*x/(3 - 2*x))))))).
a(n) = (-1)^floor(n/2) * 2 * a(n-2) = -4 * a(n-4) for all n in Z.
a(n) = c(n) * (-2)^n * a(-n) for all n in Z where c(4*k+2) = -1 else 1.
a(n) = a(n+1) = (1+I)^n * (-I)^(n/2) * (-1)^floor(n/4) if n = 2*k.
a(n) = (-1)^floor(n/4) * A016116(n).
E.g.f.: cosh(x)*(cos(x) + sin(x)) + sin(x)*sinh(x). - Stefano Spezia, Feb 04 2023

A343177 a(0)=4; if n > 0 is even then a(n) = 2^(n/2+1)+3, otherwise a(n) = 3*(2^((n-1)/2)+1).

Original entry on oeis.org

4, 6, 7, 9, 11, 15, 19, 27, 35, 51, 67, 99, 131, 195, 259, 387, 515, 771, 1027, 1539, 2051, 3075, 4099, 6147, 8195, 12291, 16387, 24579, 32771, 49155, 65539, 98307, 131075, 196611, 262147, 393219, 524291, 786435, 1048579, 1572867, 2097155, 3145731, 4194307, 6291459
Offset: 0

Views

Author

N. J. A. Sloane, Apr 26 2021

Keywords

Comments

Number of edges along the boundary of the graph G(n) described in A342759.

Crossrefs

Cf. A342759.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Programs

  • Maple
    f:=n->if n = 0 then 4 elif (n mod 2) = 0 then 2^(n/2+1)+3 else 3*(2^((n-1)/2)+1); fi;
    [seq(f(n),n=0..40)];
  • Mathematica
    LinearRecurrence[{1, 2, -2}, {4, 6, 7, 9}, 50] (* or *)
    A343177[n_] := Which[n == 0, 4, OddQ[n], 3*(2^((n-1)/2)+1), True, 2^(n/2+1)+3];
    Array[A343177, 50, 0] (* Paolo Xausa, Feb 02 2024 *)

Formula

G.f.: (4 + 2*x - 7*x^2 - 2*x^3)/((1 - x)*(1 - 2*x^2)). - Stefano Spezia, Feb 04 2023
E.g.f.: 3*cosh(x) + 2*cosh(sqrt(2)*x) + 3*sinh(x) + 3*sinh(sqrt(2)*x)/sqrt(2) - 1. - Stefano Spezia, Jul 25 2024

A354785 Numbers of the form 3*2^k or 9*2^k.

Original entry on oeis.org

3, 6, 9, 12, 18, 24, 36, 48, 72, 96, 144, 192, 288, 384, 576, 768, 1152, 1536, 2304, 3072, 4608, 6144, 9216, 12288, 18432, 24576, 36864, 49152, 73728, 98304, 147456, 196608, 294912, 393216, 589824, 786432, 1179648, 1572864, 2359296, 3145728, 4718592, 6291456, 9437184, 12582912, 18874368, 25165824, 37748736, 50331648
Offset: 1

Views

Author

N. J. A. Sloane, Jul 12 2022

Keywords

Crossrefs

The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283.

Programs

  • Mathematica
    seq[max_] := Union[Table[3*2^n, {n, 0, Floor[Log2[max/3]]}], Table[9*2^n, {n, 0, Floor[Log2[max/9]]}]]; seq[10^8] (* Amiram Eldar, Jan 16 2024 *)

Formula

Sum_{n>=1} 1/a(n) = 8/9. - Amiram Eldar, Jan 16 2024
G.f.: (3*x^2+6*x+3)/(1-2*x^2). - Georg Fischer, Apr 10 2025

A056792 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 2.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 01 2000

Keywords

Comments

A stopping problem: begin with n and at each stage if even divide by 2 or if odd subtract 1. That is, iterate A029578 while nonzero.
From Peter Kagey, Jul 16 2015: (Start)
The number of appearances of n in this sequence is identically A000045(n). Proof:
By application of the formula,
"a(0) = 0, a(2*n+1) = a(2*n) + 1 and a(2*n) = a(n) + 1",
it can be seen that:
{i: a(i) = n} = {2*i: a(i) = n-1, n>0} U {2*i+1: a(i) = n-2, n>1}.
Because the two sets on the left hand side share no elements:
|{i: a(i) = n}| = |{i: a(i) = n-1, n>0}| + |{i: a(i) = n-2, n>1}|
Notice that
|{i : a(i) = 1}| = |{1}| = 1 = A000045(1) and
|{i : a(i) = 2}| = |{2}| = 1 = A000045(2).
Therefore the number of appearances of n in this sequence is A000045(n). (End)

Examples

			12 = 1100 in binary, so a(12)=2+4-1=5.
		

Crossrefs

Equals A056791 - 1. The least inverse (indices of record values) of A056792 is A052955 prepended with 0. See also A014701, A115954, A056796, A056817.
Cf. A000120, A070939, A007088: base 2 sequences.
Analogous sequences with a different multiplier k: A061282 (k=3), A260112 (k=4).

Programs

  • Haskell
    c i = if i `mod` 2 == 0 then i `div` 2 else i - 1
    b 0 foldCount = foldCount
    b sheetCount foldCount = b (c sheetCount) (foldCount + 1)
    a056792 n = b n 0 -- Peter Kagey, Sep 02 2015
  • Maple
    a:= n-> (l-> nops(l)+add(i, i=l)-1)(convert(n, base, 2)):
    seq(a(n), n=0..105);  # Alois P. Heinz, Jul 16 2015
  • Mathematica
    f[ n_Integer ] := (c = 0; k = n; While[ k != 0, If[ EvenQ[ k ], k /= 2, k-- ]; c++ ]; c); Table[ f[ n ], {n, 0, 100} ]
    f[n_] := Floor@ Log2@ n + DigitCount[n, 2, 1]; Array[f, 100] (* Robert G. Wilson v, Jul 31 2012 *)
  • PARI
    a(n)=if(n<1,0,n-valuation(n!*sum(i=1,n,1/i),2))
    
  • PARI
    a(n)=if(n<1,0,1+a(if(n%2,n-1,n/2)))
    
  • PARI
    a(n)=if(n<1,0,n=binary(n);sum(i=1,#n,n[i])+#n-1) \\ Charles R Greathouse IV, Apr 11 2012
    

Formula

a(0) = 0, a(2*n+1) = a(2*n) + 1 and a(2*n) = a(n) + 1.
a(n) = n-valuation(A000254(n), 2) for n>0. - Benoit Cloitre, Mar 09 2004
a(n) = A000120(n) + A070939(n) - 1. - Michel Marcus, Jul 17 2015
a(n) = (weight of binary expansion of n) + (length of binary expansion of n) - 1.

Extensions

More terms from James Sellers, Sep 06 2000
More terms from David W. Wilson, Sep 07 2000

A274230 Number of holes in a sheet of paper when you fold it n times and cut off the four corners.

Original entry on oeis.org

0, 0, 1, 3, 9, 21, 49, 105, 225, 465, 961, 1953, 3969, 8001, 16129, 32385, 65025, 130305, 261121, 522753, 1046529, 2094081, 4190209, 8382465, 16769025, 33542145, 67092481, 134193153, 268402689, 536821761, 1073676289, 2147385345
Offset: 0

Views

Author

Philippe Gibone, Jun 15 2016

Keywords

Comments

The folds are always made so the longer side becomes the shorter side.
We could have counted not only the holes but also all the notches: 4, 6, 9, 15, 25, 45, 81, 153, 289, ... which has the formula a(n) = (2^ceiling(n/2) + 1) * (2^floor(n/2) + 1) and appears to match the sequence A183978. - Philippe Gibone, Jul 06 2016
The same sequence (0,0,1,3,9,21,49,...) turns up when you start with an isosceles right triangular piece of paper and repeatedly fold it in half, snipping corners as you go. Is there an easy way to see why the two questions have the same answer? - James Propp, Jul 05 2016
Reply from Tom Karzes, Jul 05 2016: (Start)
This case seems a little more complicated than the rectangular case, since with the triangle you alternate between horizontal/vertical folds vs. diagonal folds, and the resulting fold pattern is more complex, but I think the basic argument is essentially the same.
Note that with the triangle, the first hole doesn't appear until after you've made 3 folds, so if you start counting at zero folds, you have three leading zeros in the sequence: 0,0,0,1,3,9,21,... (End)
Also the number of subsets of {1,2,...,n} that contain both even and odd numbers. For example, a(3)=3 and the 3 subsets are {1,2}, {2,3}, {1,2,3}; a(4)=9 and the 9 subsets are {1,2}, {1,4}, {2,3}, {3,4}, {1,2,3}, {1,2,4}, {1,3,4}, {2,3,4}, {1,2,3,4}. (See comments in A052551 for the number of subsets of {1,2,...,n} that contain only odd and even numbers.) - Enrique Navarrete, Mar 26 2018
Also the number of integer compositions of n + 1 with an odd part other than the first or last. The complementary compositions are counted by A052955(n>0) = A027383(n) + 1. - Gus Wiseman, Feb 05 2022
Also the number of unit squares in the (n+1)-st iteration in the version of the dragon curve where the rotation directions alternate, so that any clockwise rotation is followed by a counterclockwise rotation, and vice versa (see image link below). - Talmon Silver, May 09 2023

Crossrefs

See A274626, A274627 for the three- and higher-dimensional analogs.
This is the main diagonal of A274635.
Counting fold lines instead of holes gives A027383.
Bisections are A060867 (even) and A134057 (odd).

Programs

Formula

u(0) = 0; v(0) = 0; u(n+1) = v(n); v(n+1) = 2u(n) + 1; a(n) = u(n)*v(n).
a(n) = (2^ceiling(n/2) - 1)*(2^floor(n/2) - 1).
Proof from Tom Karzes, Jul 05 2016: (Start)
Let r be the number of times you fold along one axis and s be the number of times you fold along the other axis. So r is ceiling(n/2) and s is floor(n/2), where n is the total number of folds.
When unfolded, the resulting paper has been divided into a grid of (2^r) by (2^s) rectangles. The interior grid lines will have diamond-shaped holes where they intersect (assuming diagonal cuts).
There are (2^r-1) internal grid lines along one axis and (2^s-1) along the other. The total number of internal grid line intersections is therefore (2^r-1)*(2^s-1), or (2^ceiling(n/2)-1)*(2^floor(n/2)-1) as claimed. (End)
From Colin Barker, Jun 22 2016, revised by N. J. A. Sloane, Jul 05 2016: (Start)
It follows that:
a(n) = (2^(n/2)-1)^2 for n even, a(n) = 2^n+1-3*2^((n-1)/2) for n odd.
a(n) = 3*a(n-1)-6*a(n-3)+4*a(n-4) for n>3.
G.f.: x^2 / ((1-x)*(1-2*x)*(1-2*x^2)).
a(n) = (1+2^n-2^((n-3)/2)*(3-3*(-1)^n+2*sqrt(2)+2*(-1)^n*sqrt(2))). (End)
a(n) = A000225(n) - 2*A052955(n-2) for n > 1. - Yuchun Ji, Nov 19 2018
a(n) = A079667(2^(n-1)) for n >= 1. - J. M. Bergot, Jan 18 2021
a(n) = 2^(n-1) - A052955(n) = 2^(n-1) - A027383(n) - 1. - Gus Wiseman, Jan 29 2022
E.g.f.: cosh(x) + cosh(2*x) - 2*cosh(sqrt(2)*x) + sinh(x) + sinh(2*x) - 3*sinh(sqrt(2)*x)/sqrt(2). - Stefano Spezia, Apr 06 2022

A119963 Triangle T(n,k), 0 <= k <= n, read by rows, with T(2n,2k) = T(2n+1,2k) = T(2n+1,2k+1) = T(2n+2,2k+1) = binomial(n,k).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 3, 2, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 4, 3, 6, 3, 4, 1, 1, 1, 1, 4, 4, 6, 6, 4, 4, 1, 1, 1, 1, 5, 4, 10, 6, 10, 4, 5, 1, 1, 1, 1, 5, 5, 10, 10, 10, 10, 5, 5, 1, 1, 1, 1, 6, 5, 15, 10, 20, 10, 15, 5, 6, 1, 1, 1, 1, 6, 6, 15, 15, 20, 20, 15, 15, 6, 6, 1, 1, 1, 1, 7, 6, 21, 15, 35, 20, 35, 15, 21, 6, 7, 1, 1
Offset: 0

Views

Author

Philippe Deléham, Aug 02 2006

Keywords

Comments

From John P. McSorley, Aug 24 2010: (Start)
A combinatorial interpretation of this triangle is as follows:
Ignore the first column of 1's of the above triangle and the call the (n,k) entry of the new triangle formed RE(n,k).
Hence row 8 of the 'RE(n,k)' triangle is 1 4 3 6 3 4 1 1.
Now see sequence A180171 for the definition of a k-reverse of n.
Briefly, a k-reverse of n is a k-composition of n which is cyclically equivalent to its reverse.
Sequence A180171 is the 'R(n,k)' triangle read by rows where R(n,k) is the total number of k-reverses of n.
Then RE(n,k) is the number of k-reverses of n up to cyclic equivalence.
In sequence A180171 we have R(8,3)=9 because there are 9 3-reverses of 8.
In cyclically equivalent classes: {116,611,161} {224,422,242}, and {233,323,332}; since there are 3 such classes we have RE(8,3)=3.
Similarly, in A180171, we have R(8,6)=21 because all 21 6-compositions of 8 are 6-reverses of 8, but they come in 4 cyclically equivalent classes (with representatives 111113, 111122, 111212, and 112112) hence RE(8,6)=4.
There is another (equivalent) interpretation for RE(n,k) involving k-subsets of Z_n, the integers modulo n, and the multiplier -1. See the McSorley/Schoen paper below for more details.
In this case it is convenient to count k-subsets up to dihedral equivalence, rather than cyclic equivalence.
The counts are the same. The row sums of the 'RE(n,k)' triangle give sequence A052955.
(End)
From Petros Hadjicostas, Oct 12 2017: (Start)
When 1 <= k <= n, each cyclically equivalence class of k-reverses of n is a "Sommerville symmetrical cyclic composition," which was introduced by Sommerville (1909). On pp. 301-304 of his paper, he proves that the number of such (equivalence classes of) compositions of n with length k is exactly T(n,k) = RE(n,k).
The equivalence class of a Sommerville symmetrical cyclic composition contains at least one palindromic composition (type I) or a composition that becomes a palindromic composition if we remove the first part (type II). A composition with only one part is a palindromic composition of both types. Hadjicostas and Zhang (2017) have proved that each equivalence class of k-reverses of n contains exactly two compositions that are either of type I or type II (except in the case when k | n and all the parts are the same).
For example, consider the case with n=8 and k=3, where RE(8,3)=3. As pointed above by J. P. McSorley, in cyclically equivalent classes we have {116,611,161} {224,422,242}, and {233,323,332}. The first class contains one composition of type I (161) and one of type II (611); the second class contains one composition of type I (242) and one of type II (422); and the last class contains one composition of type I (323) and one of type II (233).
When n = 6 and k = 4, the class of 4-reverses {1221, 2211, 2112, 1122} contains two compositions of type I (1221 and 2112).
If A is a set of positive integers and 1 <= k <= n, let RE_A(n,k) be the total number of Sommerville symmetrical cyclic compositions of n with length k and parts only in A (= number of cyclically equivalence classes of k-reverses of n with parts only in A). Then the g.f. of RE_A(n,k) is Sum_{n,k >= 1} RE_A(n,k) * x^n * y^k = (-1/2) + (1 + y * f_A(x))^2/(2 * (1 - y^2 * f_A(x^2)), where f_A(x) = Sum_{m in A} x^m. (For this sequence, A = all positive integers.)
Sequence A292200 contains the total number of Sommerville symmetrical cyclic compositions of n that are Carlitz (compositions that have length one, or have length >= 1 and adjacent parts of the composition on a circle are distinct).
(End)

Examples

			Triangle begins (with rows for n >= 0 and columns for k >= 0) as follows:
  1;
  1, 1;
  1, 1, 1;
  1, 1, 1, 1;
  1, 1, 2, 1, 1;
  1, 1, 2, 2, 1, 1;
  1, 1, 3, 2, 3, 1, 1;
  1, 1, 3, 3, 3, 3, 1, 1;
  1, 1, 4, 3, 6, 3, 4, 1, 1;
  1, 1, 4, 4, 6, 6, 4, 4, 1, 1;
  ...
		

References

  • John P. McSorley, Counting k-compositions of n with palindromic and related structures, preprint, 2010. [From John P. McSorley, Aug 24 2010]

Crossrefs

The row sums of the T(n,k) triangle give sequence A029744 whose terms are 1 more than the terms of sequence A052955 (row sums of RE(n,k) triangle). See sequence A029744 where there is a reference to necklaces relevant to the combinatorial interpretation and the McSorley and McSorley/Schoen papers given here. - John P. McSorley, Aug 31 2010

Programs

  • Mathematica
    Table[Binomial[Floor[(n - Boole[OddQ@ k])/2], Floor[k/2]], {n, 0, 10}, {k, 0, n}] (* Michael De Vlieger, Oct 11 2017, after PARI by Andrew Howroyd *)
  • PARI
    T(n,k) = binomial((n-k%2)\2, k\2); \\ Andrew Howroyd, Oct 08 2017

Formula

G.f.: Sum_{n,k >= 1} RE(n,k)*x^n*y^k = (1+x*y-x^2)*x*y/((1-x)*(1-x^2-x^2*y^2)). - Petros Hadjicostas, Oct 12 2017
G.f.: Sum_{n,k >= 0} T(n,k)*x^n*y^k = (1+x*y)*(1+x)/(1-x^2-x^2*y^2) as above, but adding 1/(1-x) to include n,k = 0 terms. - Paul Sampson, Nov 22 2017
T(n, k) = binomial(floor(n/2) - (k mod 2) * (1 - (n mod 2)), floor(k/2)) for 0 <= k <= n. - Petros Hadjicostas, May 29 2019

Extensions

Corrected by Philippe Deléham, Aug 20 2010

A349058 Number of weakly alternating patterns of length n.

Original entry on oeis.org

1, 1, 3, 11, 43, 203, 1123, 7235, 53171, 439595, 4037371, 40787579, 449500595, 5366500163, 68997666867, 950475759899, 13966170378907, 218043973366091, 3604426485899203, 62894287709616755, 1155219405655975763, 22279674547003283003, 450151092568978825707
Offset: 0

Views

Author

Gus Wiseman, Dec 04 2021

Keywords

Comments

We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217.
We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either.

Examples

			The a(1) = 1 through a(3) = 11 patterns:
  (1)  (1,1)  (1,1,1)
       (1,2)  (1,1,2)
       (2,1)  (1,2,1)
              (1,2,2)
              (1,3,2)
              (2,1,1)
              (2,1,2)
              (2,1,3)
              (2,2,1)
              (2,3,1)
              (3,1,2)
		

Crossrefs

The strict case is A001250, complement A348615.
The strong case of compositions is A025047, ranked by A345167.
The unordered version is A052955.
The strong case is A345194, with twins A344605. Also the directed case.
The version for compositions is A349052, complement A349053.
The version for permutations of prime indices: A349056, complement A349797.
The version for compositions is ranked by A349057.
The version for ordered factorizations is A349059, strong A348610.
The version for partitions is A349060, complement A349061.
A003242 counts Carlitz (anti-run) compositions.
A005649 counts anti-run patterns.
A344604 counts alternating compositions with twins.
A345163 counts normal partitions with an alternating permutation.
A345170 counts partitions w/ an alternating permutation, complement A345165.
A345192 counts non-alternating compositions, ranked by A345168.
A349055 counts multisets w/ an alternating permutation, complement A349050.

Programs

  • Mathematica
    allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s, y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
    whkQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]<=y[[m+1]],y[[m]]>=y[[m+1]]],{m,1,Length[y]-1}];
    Table[Length[Select[Join@@Permutations/@allnorm[n],whkQ[#]||whkQ[-#]&]],{n,0,6}]
  • PARI
    R(n,k)={my(v=vector(k,i,1), u=vector(n)); for(r=1, n, if(r%2==0, my(s=v[k]); forstep(i=k, 2, -1, v[i] = s - v[i-1]); v[1] = s); for(i=2, k, v[i] += v[i-1]); u[r]=v[k]); u}
    seq(n)= {concat([1], -vector(n,i,1) + 2*sum(k=1, n, R(n, k)*sum(r=k, n, binomial(r, k)*(-1)^(r-k)) ) )} \\ Andrew Howroyd, Jan 13 2024

Extensions

a(9)-a(18) from Alois P. Heinz, Dec 10 2021
a(19) onwards from Andrew Howroyd, Jan 13 2024

A014701 Number of multiplications to compute n-th power by the Chandah-sutra method.

Original entry on oeis.org

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

Views

Author

James Kilfiger (jamesk(AT)maths.warwick.ac.uk)

Keywords

Comments

In other words, number of steps to reach 1 starting from n and using the process: x -> x-1 if n is odd and x -> x/2 otherwise.
a(n) = number of 0's + twice number of 1's (disregarding the leading digit 1) in the binary expansion of n, i.e., A007088(n). - Lekraj Beedassy, May 28 2010
From Daniel Forgues, Jul 31 2012: (Start)
For the binary Fibonacci rabbits sequence (A036299) (cf. OEIS Wiki link below) we have the substitution/concatenation rule: a(n), n >= 3, may be obtained by the concatenation of a(n-1) and a(n-2), with a(1) = 0, a(2) = 1. Thus, using . (dot) as the concatenation operator, we have the recursive substitution/concatenation
a(n) = a(n-0)
a(n) = a(n-1).a(n-2)
a(n) = a(n-2).a(n-3).a(n-3).a(n-4)
a(n) = a(n-3).a(n-4).a(n-4).a(n-5).a(n-4).a(n-5).a(n-5).a(n-6)
which suggests the sequence
{0}
{1, 2}
{2, 3, 3, 4}
{3, 4, 4, 5, 4, 5, 5, 6}
whose concatenation gives A014701 (this sequence).
Number of multiplications to compute n-th power by the Chandah-sutra method, also called left-to-right binary exponentiation:
x^1 = x^( 1_2) = (x) (0 prod)
x^2 = x^( 10_2) = (x^2) (1 prod)
x^3 = x^( 11_2) = (x^2) * (x) (2 prod)
x^4 = x^( 100_2) = (x^2)^2 (2 prod)
x^5 = x^( 101_2) = (x^2)^2 * (x) (3 prod)
x^6 = x^( 110_2) = (x^2)^2 * (x^2) (3 prod)
x^7 = x^( 111_2) = (x^2)^2 * (x^2) * (x) (4 prod)
x^8 = x^(1000_2) = ((x^2)^2)^2 (3 prod) (End)
From Ya-Ping Lu, Mar 03 2021: (Start)
Index at which record m occurs is A052955(m).
First appearance of m in the sequence (or the record value m) is at n = 2^(m/2 + 1) - 1 for even m, and at n = 3*2^((m - 1)/2) - 1 for odd m.
The last appearance of m in the sequence is at n = 2^m. (End)
a(n) is the digit sum of n-1 in bijective base-2. Since the Fibonacci number F(m) can be defined as the number of ways to compose m as the sum of 1s and 2s, we get that m appears F(m) times in the sequence. - Oscar Cunningham, Apr 14 2024
Conjecture: a(n+1) is the minimal number of steps to go from 0 to n, by choosing before each step, after the first step, whether to keep the same step length or double it. The initial step length is 1. - Jean-Marc Rebert, May 15 2025

Examples

			5 -> 4 -> 2 -> 1 so 3 steps are needed to reach 1 hence a(5)=3; 9 -> 8 -> 4 -> 2 -> 1 hence a(9)=4.
		

Crossrefs

Programs

  • Haskell
    a014701 1 = 0
    a014701 n = a007953 $ a007931 (n - 1)
    -- Reinhard Zumkeller, Oct 26 2012
    
  • Maple
    A014701 := proc(n) local j,k; j := n; k := 0; while(j>1) do if j mod 2=1 then j := j-1 else j := j/2 fi; k := k+1 od end;
    # second Maple program:
    a:= n-> add(i+1, i=Bits[Split](n))-2:
    seq(a(n), n=1..128);  # Alois P. Heinz, Aug 30 2021
  • Mathematica
    a[n_] := DigitCount[n, 2] /. {x_, y_} -> 2x + y - 2; Array[a, 100] (* Robert G. Wilson v, Jul 31 2012 *)
  • PARI
    a(n)=hammingweight(n)+logint(n,2)-1 \\ Charles R Greathouse IV, Dec 29 2016
    
  • Python
    def a(n):
        if n==1:
            return 0
        return a(n//2)+1+n%2
    for i in range(1,60):
        print(a(i), end=", ")
    # Pablo Hueso Merino, Oct 28 2020

Formula

a(n) = A056792(n) - 1 = A056791(n) - 2.
a(n) = floor(log_2(n)) + (number of 1's in binary representation of n) - 1. - Corrected (- 1 at end) by Daniel Forgues, Aug 01 2012
a(2^n) = n, a(2^n-1) = 2*(n-1), and for n >= 2, log_2(n) <= a(n) <= 2*log_2(n) - 1. - Robert FERREOL, Oct 01 2014
Let u(1) = 1, u(2*n) = u(n)+1, u(2*n+1) = u(2*n)+1; then a(1) = 0 and a(n) = u(n-1). - Benoit Cloitre, Dec 19 2002
G.f.: -2/(1-x) + (1/(1-x)) * Sum_{k>=0} (2*x^2^k + x^2^(k+1))/(1+x^2^k). - Ralf Stephan, Aug 15 2003
From {0}, apply the substitution rule (n -> n+1, n+2) repeatedly, giving {{0}, {1, 2}, {2, 3, 3, 4}, {3, 4, 4, 5, 4, 5, 5, 6}, ...} and concatenate. - Daniel Forgues, Jul 31 2012
For n > 1: a(n) = A007953(A007931(n-1)). - Reinhard Zumkeller, Oct 26 2012
a(n) >= A003313(n). - Charles R Greathouse IV, Jan 03 2018
a(n) = a(floor(n/2)) + 1 + (n mod 2) for n > 1. - Pablo Hueso Merino, Oct 28 2020
a(n+1) = max_{1<=i<=n} (H(i) + H(n-i)) where H(n) denotes the Hamming weight of n (A000120(n)). See Lemma 8 in Gruber/Holzer 2021 article. - Hermann Gruber, Jun 26 2024

A164090 a(n) = 2*a(n-2) for n > 2; a(1) = 2, a(2) = 3.

Original entry on oeis.org

2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304, 131072, 196608, 262144, 393216, 524288, 786432, 1048576, 1572864, 2097152, 3145728
Offset: 1

Views

Author

Klaus Brockhaus, Aug 09 2009

Keywords

Comments

Interleaving of A000079 without initial 1 and A007283.
Agrees from a(2) onward with A145751 for all terms listed there (up to 65536). Apparently equal to 2, 3 followed by A090989. Equals 2 followed by A163978.
Binomial transform is A000129 without first two terms, second binomial transform is A020727, third binomial transform is A164033, fourth binomial transform is A164034, fifth binomial transform is A164035.
Number of achiral necklaces or bracelets with n beads using up to 2 colors. For n=5, the eight achiral necklaces or bracelets are AAAAA, AAAAB, AAABB, AABAB, AABBB, ABABB, ABBBB, and BBBBB. - Robert A. Russell, Sep 22 2018

Crossrefs

Programs

  • Magma
    [ n le 2 select n+1 else 2*Self(n-2): n in [1..42] ];
    
  • Mathematica
    a[n_] := If[EvenQ[n], 3*2^(n/2 - 1), 2^((n + 1)/2)]; Array[a, 42] (* Jean-François Alcover, Oct 12 2017 *)
    RecurrenceTable[{a[1]==2,a[2]==3,a[n]==2a[n-2]},a,{n,50}] (* or *) LinearRecurrence[{0,2},{2,3},50] (* Harvey P. Dale, Mar 01 2018 *)
  • PARI
    a(n) = if(n%2,2,3) * 2^((n-1)\2); \\ Andrew Howroyd, Oct 07 2017

Formula

a(n) = A029744(n+1).
a(n) = A052955(n-1) + 1.
a(n) = A027383(n-2) + 2 for n > 1.
a(n) = A060482(n-1) + 3 for n > 3.
a(n) = A070875(n) - A070875(n-1).
a(n) = (7 - (-1)^n)*2^((1/4)*(2*n - 1 + (-1)^n))/4.
G.f.: x*(2+3*x)/(1-2*x^2).
a(n) = A063759(n-1), n>1. - R. J. Mathar, Aug 17 2009
Sum_{n>=1} 1/a(n) = 5/3. - Amiram Eldar, Mar 28 2022
Previous Showing 21-30 of 61 results. Next