A227349
Product of lengths of runs of 1-bits in binary representation of n.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 4, 2, 2, 4, 6, 3, 3, 3, 6, 4, 4, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 4, 5, 2, 2, 2, 4, 2, 2, 4, 6, 2, 2, 2, 4, 4, 4, 6, 8, 3, 3, 3, 6, 3, 3, 6, 9, 4
Offset: 0
a(0) = 1, as zero has no runs of 1's, and an empty product is 1.
a(1) = 1, as 1 is "1" in binary, and the length of that only 1-run is 1.
a(2) = 1, as 2 is "10" in binary, and again there is only one run of 1-bits, of length 1.
a(3) = 2, as 3 is "11" in binary, and there is one run of two 1-bits.
a(55) = 6, as 55 is "110111" in binary, and 2 * 3 = 6.
a(119) = 9, as 119 is "1110111" in binary, and 3 * 3 = 9.
From _Omar E. Pol_, Feb 10 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
1;
1;
1,2;
1,1,2,3;
1,1,1,2,2,2,3,4;
1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5;
1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4,2,2,2,4,2,2,4,6,3,3,3,6,4,4,5,6;
...
Right border gives A028310: 1 together with the positive integers. (End)
From _Omar E. Pol_, Mar 19 2015: (Start)
Also, the sequence can be written as an irregular tetrahedron T(s, r, k) as shown below:
1;
..
1;
..
1;
2;
....
1,1;
2;
3;
........
1,1,1,2;
2,2;
3;
4;
................
1,1,1,2,1,1,2,3;
2,2,2,4;
3,3;
4;
5;
................................
1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4;
2,2,2,4,2,2,4,6;
3,3,3,6;
4,4;
5;
6;
...
Apart from the initial 1, we have that T(s, r, k) = T(s+1, r, k). (End)
Cf.
A000120 (sum of lengths of runs of 1-bits),
A167489,
A227350,
A227193,
A278222,
A245562,
A284562,
A284569,
A283972,
A284582,
A284583.
Differs from similar
A284580 for the first time at n=119, where a(119) = 9, while
A284580(119) = 5.
-
a:= proc(n) local i, m, r; m, r:= n, 1;
while m>0 do
while irem(m, 2, 'h')=0 do m:=h od;
for i from 0 while irem(m, 2, 'h')=1 do m:=h od;
r:= r*i
od; r
end:
seq(a(n), n=0..100); # Alois P. Heinz, Jul 11 2013
ans:=[];
for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
for i from 1 to L1 do
if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
elif out1 = 0 and t1[i] = 1 then c:=c+1;
elif out1 = 1 and t1[i] = 0 then c:=c;
elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
fi;
if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
od:
a:=mul(i, i in lis);
ans:=[op(ans), a];
od:
ans; # N. J. A. Sloane, Sep 05 2014
-
onBitRunLenProd[n_] := Times @@ Length /@ Select[Split @ IntegerDigits[n, 2], #[[1]] == 1 & ]; Array[onBitRunLenProd, 100, 0] (* Jean-François Alcover, Mar 02 2016 *)
-
from operator import mul
from functools import reduce
from re import split
def A227349(n):
return reduce(mul, (len(d) for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # Chai Wah Wu, Sep 07 2014
-
# uses[RLT from A246660]
A227349_list = lambda len: RLT(lambda n: n, len)
A227349_list(88) # Peter Luschny, Sep 07 2014
-
(define (A227349 n) (apply * (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
(define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z)))))
(define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))
A112934
a(0) = 1; a(n+1) = Sum_{k=0..n} a(k)*A001147(n-k), where A001147 = double factorial numbers.
Original entry on oeis.org
1, 1, 2, 6, 26, 158, 1282, 13158, 163354, 2374078, 39456386, 737125446, 15279024026, 347786765150, 8621313613954, 231139787526822, 6663177374810266, 205503866668090750, 6751565903597571842
Offset: 0
A(x) = 1 + x + 2*x^2 + 6*x^3 + 26*x^4 + 158*x^5 + 1282*x^6 + ...
1/A(x) = 1 - x - x^2 - 3*x^3 - 15*x^4 - 105*x^5 - ... - A001147(n)*x^(n+1) - ...
a(4) = a(3+1) = Sum_{k=0..3} a(k)*A001147(3-k) = a(0)*5!! + a(1)*3!! + a(2)*1 + a(3)*1 = 1*15 + 1*3 + 2*1 + 6*1 = 26. - _Michael B. Porter_, Jul 22 2016
-
a_list := proc(len) local A, n; A[0] := 1; A[1] := 1;
for n from 2 to len-1 do A[n] := (2*n-1)*A[n-1] - add(A[j]*A[n-j], j=1..n-1) od;
convert(A, list) end: a_list(19); # Peter Luschny, May 22 2017
# Alternative:
T := proc(n, k) option remember; if k = 0 then 1 else if k = n then T(n, k-1)
else (n - k) * T(n, k - 1) + T(n - 1, k) fi fi end:
a := n -> T(n, n): seq(a(n), n = 0..18); # Peter Luschny, Oct 02 2023
-
a[0] = 1; a[n_] := a[n] = Sum[a[k]*(2n - 2k - 3)!!, {k, 0, n - 1}]; Table[ a[n], {n, 0, 19}] (* Robert G. Wilson v, Oct 12 2005 *)
-
{a(n)=local(F=1+x+x*O(x^n));for(i=1,n,F=1+x+2*x^2*deriv(F)/F); return(polcoeff(F,n,x))}
-
{a(n) = local(A); if( n<1, n==0, A = vector(n); A[1] = 1; for( k=2, n, A[k] = (2*k - 1) * A[k-1] - sum( j=1, k-1, A[j] * A[k-j])); A[n])} /* Michael Somos, Jul 23 2011 */
A109081
Reversion of x*(1-x)*(1-x^2)*(1-x^3)/(1-x^6) = x*(1-x)^2/(1-x+x^2).
Original entry on oeis.org
1, 1, 3, 10, 37, 146, 602, 2563, 11181, 49720, 224540, 1027038, 4748042, 22150519, 104146733, 493012682, 2347796965, 11239697816, 54061835288, 261130778516, 1266125122956, 6160158505040, 30065608532008, 147161532388934
Offset: 1
a(5) = 37 = the upper left term of M^4: (37, 26, 12, 4, 1); where (37 + 26 + 12 + 4 + 1) = 80 = A106228(5). - _Gary W. Adamson_, Nov 15 2011
G.f. = x + x^2 + 3*x^3 + 10*x^4 + 37*x^5 + 146*x^6 + 602*x^7 + 2563*x^8 + ...
- Robert Israel, Table of n, a(n) for n = 1..1400
- Alexander Burstein and Louis W. Shapiro, Pseudo-involutions in the Riordan group, arXiv:2112.11595 [math.CO], 2021.
- Nancy S. S. Gu, Nelson Y. Li, and Toufik Mansour, 2-Binary trees: bijections and related issues, Discr. Math., 308 (2008), 1209-1221.
- Tian-Xiao He and Louis W. Shapiro, Row sums and alternating sums of Riordan arrays, Linear Algebra and its Applications, Volume 507, 15 October 2016, Pages 77-95. See R_2^{-}.
- JiSun Huh, Sangwook Kim, Seunghyun Seo, and Heesung Shin, Bijections on pattern avoiding inversion sequences and related objects, arXiv:2404.04091 [math.CO], 2024. See p. 22.
- Markus Kuba and Alois Panholzer, Enumeration formulas for pattern restricted Stirling permutations, Discrete Math. 312 (2012), no. 21, 3179--3194. MR2957938. - From _N. J. A. Sloane_, Sep 25 2012
- Hanna Mularczyk, Lattice Paths and Pattern-Avoiding Uniquely Sorted Permutations, arXiv:1908.04025 [math.CO], 2019.
- Jun Yan, Results on pattern avoidance in parking functions, arXiv:2404.07958 [math.CO], 2024. See p. 11.
- Jun Yan, Lattice paths enumerations weighted by ascent lengths, arXiv:2501.01152 [math.CO], 2025. See p. 7.
-
[&+[Binomial(n, k)/(n-k+1)*Binomial(n+k-1, n-k): k in [0..n]]: n in [0..25]]; // Vincenzo Librandi, Sep 23 2015
-
S:= series(RootOf(-x*z^2+z^3+x*z-2*z^2-x+z, z), x, 101):
seq(coeff(S,x,j),j=1..100); # Robert Israel, Nov 19 2015
-
a[ n_] := If[ n < 2, Boole[n == 1], (n - 1) HypergeometricPFQ[ {n, 1 - n, 2 - n}, {3/2, 2}, 1/4]]; (* Michael Somos, May 28 2014 *)
Join[{1}, Table[Sum[ Binomial[n,k] / (n-k+1) Binomial[n+k-1, n-k], {k, n}], {n, 25}]] (* Vincenzo Librandi, Sep 23 2015 *)
-
{a(n) = if( n<1, 0, polcoeff( serreverse( x * (1 - x) * (1 - x^2) * (1 - x^3) / (1 - x^6) + x * O(x^n)), n))};
-
{a(n)=sum(k=0,n,binomial(n,k)/(n-k+1)*binomial(n+k-1,n-k))} \\ Paul D. Hanna, Jun 19 2009
-
def A109081(n) :
return (n-1)*hypergeometric([n,1-n,2-n],[3/2, 2],1/4) if n > 1 else 1
[simplify(A109081(n)) for n in (1..24)] # Peter Luschny, Aug 02 2012, Nov 13 2014
A204502
Numbers such that floor[a(n)^2 / 9] is a square.
Original entry on oeis.org
0, 1, 2, 3, 4, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177
Offset: 1
The squares are in
A204503, the squares with last base-9 digit dropped in
A204504, and the square roots of the latter in
A028310.
-
Select[Range[0,200],IntegerQ[Sqrt[Floor[#^2/9]]]&] (* Harvey P. Dale, May 05 2018 *)
-
b=9;for(n=0,200,issquare(n^2\b) & print1(n","))
A062157
a(n) = 0^n - (-1)^n.
Original entry on oeis.org
0, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1
Offset: 0
G.f. = x - x^2 + x^3 - x^4 + x^5 - x^6 + x^7 - x^8 + x^9 - x^10 + ... - _Michael Somos_, Feb 20 2024
-
[0^n-(-1)^n: n in [0..100]]; // Vincenzo Librandi, Aug 15 2015
-
[0] cat &cat[ [1, -1]: n in [1..80] ]; // Vincenzo Librandi, Aug 15 2015
-
PadRight[{0},120,{-1,1}] (* Harvey P. Dale, Aug 20 2012 *)
Join[{0},LinearRecurrence[{-1},{1},101]] (* Ray Chandler, Aug 12 2015 *)
f[n_] := 0^n - (-1)^n; f[0] = 0; Array[f, 105, 0] (* or *)
CoefficientList[ Series[ x/(1 + x), {x, 0, 80}], x] (* or *)
Numerator@ CoefficientList[ Series[ Log[1 + x], {x, 0, 80}], x] (* Robert G. Wilson v, Aug 14 2015 *)
-
{a(n) = if( n<1, 0, -(-1)^n )}; /* Michael Somos, Jul 05 2009 */
A347461
Number of distinct possible alternating products of integer partitions of n.
Original entry on oeis.org
1, 1, 2, 3, 4, 6, 7, 10, 12, 16, 19, 23, 27, 34, 41, 49, 57, 67, 78, 91, 106, 125, 147, 166, 187, 215, 245, 277, 317, 357, 405, 460, 524, 592, 666, 740, 829, 928, 1032, 1147, 1273, 1399, 1555, 1713, 1892, 2087, 2298, 2523, 2783, 3070, 3383, 3724, 4104, 4504
Offset: 0
Partitions representing each of the a(7) = 10 alternating products are:
(7) -> 7
(61) -> 6
(52) -> 5/2
(511) -> 5
(43) -> 4/3
(421) -> 2
(4111) -> 4
(331) -> 1
(322) -> 3
(3211) -> 3/2
The version for alternating sum is
A004526.
A027187 counts partitions of even length.
A027193 counts partitions of odd length.
A103919 counts partitions by sum and alternating sum (reverse:
A344612).
A122768 counts distinct submultisets of partitions.
A126796 counts complete partitions.
A293627 counts knapsack factorizations by sum.
A301957 counts distinct subset-products of prime indices.
A304793 counts distinct positive subset-sums of prime indices.
Cf.
A000070,
A001055,
A002033,
A002219,
A028983,
A119620,
A325768,
A345926,
A347443,
A347444,
A347445,
A347446.
-
altprod[q_]:=Product[q[[i]]^(-1)^(i-1),{i,Length[q]}];
Table[Length[Union[altprod/@IntegerPartitions[n]]],{n,0,30}]
A347462
Number of distinct possible reverse-alternating products of integer partitions of n.
Original entry on oeis.org
1, 1, 2, 3, 4, 6, 8, 11, 13, 17, 22, 28, 33, 42, 51, 59, 69, 84, 100, 117, 137, 163, 191, 222, 256, 290, 332, 378, 429, 489, 564, 643, 729, 819, 929, 1040, 1167, 1313, 1473, 1647, 1845, 2045, 2272, 2521, 2785, 3076, 3398, 3744, 4115, 4548, 5010, 5524, 6086
Offset: 0
Partitions representing each of the a(7) = 11 reverse-alternating products:
(7) -> 7
(61) -> 1/6
(52) -> 2/5
(511) -> 5
(43) -> 3/4
(421) -> 2
(4111) -> 1/4
(331) -> 1
(322) -> 3
(3211) -> 2/3
(2221) -> 1/2
The version for non-reverse alternating sum instead of product is
A004526.
The non-reverse version is
A347461.
A027187 counts partitions of even length.
A027193 counts partitions of odd length.
A103919 counts partitions by sum and alternating sum (reverse:
A344612).
A122768 counts distinct submultisets of partitions.
A126796 counts complete partitions.
A293627 counts knapsack factorizations by sum.
A301957 counts distinct subset-products of prime indices.
A304793 counts distinct positive subset-sums of prime indices.
Cf.
A000070,
A001055,
A002033,
A002219,
A028983,
A119620,
A325768,
A345926,
A347443,
A347444,
A347445,
A347446.
-
revaltprod[q_]:=Product[Reverse[q][[i]]^(-1)^(i-1),{i,Length[q]}];
Table[Length[Union[revaltprod/@IntegerPartitions[n]]],{n,0,30}]
A144328
A002260 preceded by a column of 1's: a (1, 1, 2, 3, 4, 5, ...) crescendo triangle by rows.
Original entry on oeis.org
1, 1, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 3, 4, 1, 1, 2, 3, 4, 5, 1, 1, 2, 3, 4, 5, 6, 1, 1, 2, 3, 4, 5, 6, 7, 1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Offset: 1
First few rows of the triangle:
1;
1, 1;
1, 1, 2;
1, 1, 2, 3;
1, 1, 2, 3, 4;
1, 1, 2, 3, 4, 5;
...
-
a144328 n k = a144328_tabl !! (n-1) !! (k-1)
a144328_row n = a144328_tabl !! (n-1)
a144328_tabl = [1] : map (\xs@(x:_) -> x : xs) a002260_tabl
-- Reinhard Zumkeller, Apr 29 2015
-
Flatten[Table[Join[{1},Range[n]],{n,0,11}]] (* Harvey P. Dale, Aug 10 2013 *)
-
from math import comb, isqrt
def A144328(n): return n-comb((m:=isqrt(k:=n<<1))+(k>m*(m+1)),2)-(comb(isqrt(n-1<<1)+1,2)!=n-1) # Chai Wah Wu, Nov 08 2024
A228617
T(n,k) is the number of s in {1,...,n}^n having shortest run with the same value of length k; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
Original entry on oeis.org
1, 0, 1, 0, 2, 2, 0, 24, 0, 3, 0, 240, 12, 0, 4, 0, 3080, 40, 0, 0, 5, 0, 46410, 210, 30, 0, 0, 6, 0, 822612, 840, 84, 0, 0, 0, 7, 0, 16771832, 5208, 112, 56, 0, 0, 0, 8, 0, 387395856, 23760, 720, 144, 0, 0, 0, 0, 9, 0, 9999848700, 148410, 2610, 180, 90, 0, 0, 0, 0, 10
Offset: 0
T(3,1) = 24: [1,1,2], [1,1,3], [1,2,1], [1,2,2], [1,2,3], [1,3,1], [1,3,2], [1,3,3], [2,1,1], [2,1,2], [2,1,3], [2,2,1], [2,2,3], [2,3,1], [2,3,2], [2,3,3], [3,1,1], [3,1,2], [3,1,3], [3,2,1], [3,2,2], [3,2,3], [3,3,1], [3,3,2].
T(3,3) = 3: [1,1,1], [2,2,2], [3,3,3].
Triangle T(n,k) begins:
1;
0, 1;
0, 2, 2;
0, 24, 0, 3;
0, 240, 12, 0, 4;
0, 3080, 40, 0, 0, 5;
0, 46410, 210, 30, 0, 0, 6;
0, 822612, 840, 84, 0, 0, 0, 7;
0, 16771832, 5208, 112, 56, 0, 0, 0, 8;
Columns k=0-10 give:
A000007,
A228619,
A228621,
A228622,
A228630,
A228631,
A228632,
A228633,
A228634,
A228635,
A228636.
A123110
Triangle T(n,k), 0 <= k <= n, read by rows given by [0,1,0,0,0,0,0,0,0,0,...] DELTA [1,0,-1,1,0,0,0,0,0,0,...] where DELTA is the operator defined in A084938.
Original entry on oeis.org
1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 0
Triangle begins:
1;
0, 1;
0, 1, 1;
0, 1, 1, 1;
0, 1, 1, 1, 1;
0, 1, 1, 1, 1, 1;
0, 1, 1, 1, 1, 1, 1;
0, 1, 1, 1, 1, 1, 1, 1;
0, 1, 1, 1, 1, 1, 1, 1, 1;
0, 1, 1, 1, 1, 1, 1, 1, 1, 1;
Essentially the same sequence as
A114607.
After the initial a(0)=1, the characteristic function of
A014132.
Comments