A003024
Number of acyclic digraphs (or DAGs) with n labeled nodes.
Original entry on oeis.org
1, 1, 3, 25, 543, 29281, 3781503, 1138779265, 783702329343, 1213442454842881, 4175098976430598143, 31603459396418917607425, 521939651343829405020504063, 18676600744432035186664816926721, 1439428141044398334941790719839535103, 237725265553410354992180218286376719253505
Offset: 0
For n = 2 the three (0,1)-matrices are {{{1, 0}, {0, 1}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}}.
- Archer, K., Gessel, I. M., Graves, C., & Liang, X. (2020). Counting acyclic and strong digraphs by descents. Discrete Mathematics, 343(11), 112041.
- S. R. Finch, Mathematical Constants, Cambridge, 2003, p. 310.
- F. Harary and E. M. Palmer, Graphical Enumeration, Academic Press, NY, 1973, p. 19, Eq. (1.6.1).
- R. W. Robinson, Counting labeled acyclic digraphs, pp. 239-273 of F. Harary, editor, New Directions in the Theory of Graphs. Academic Press, NY, 1973.
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- R. P Stanley, Enumerative Combinatorics I, 2nd. ed., p. 322.
- Alois P. Heinz, Table of n, a(n) for n = 0..77 (first 41 terms from T. D. Noe)
- T. E. Allen, J. Goldsmith, and N. Mattei, Counting, Ranking, and Randomly Generating CP-nets, 2014.
- Huantian Cao, AutoGF: An Automated System to Calculate Coefficients of Generating Functions, thesis, 2002.
- Huantian Cao, AutoGF: An Automated System to Calculate Coefficients of Generating Functions, thesis, 2002 [Local copy, with permission]
- Eunice Y.-J. Chen, A. Choi, and A. Darwiche, On Pruning with the MDL Score, JMLR: Workshop and Conference Proceedings vol 52, 98-109, 2016.
- S. Engstrom, Random acyclic orientations of graphs, Master's thesis written at the department of Mathematics at the Royal Institute of Technology (KTH) in Stockholm, Jan. 2013.
- Zehao Jin, Mario Pasquato, Benjamin L. Davis, Tristan Deleu, Yu Luo, Changhyun Cho, Pablo Lemos, Laurence Perreault-Levasseur, Yoshua Bengio, Xi Kang, Andrea Valerio Maccio, and Yashar Hezaveh, A Data-driven Discovery of the Causal Connection between Galaxy and Black Hole Evolution, arXiv:2410.00965 [astro-ph.GA], 2024. See p. 33.
- Zehao Jin, Mario Pasquato, Benjamin L. Davis, Andrea V. Macciò, and Yashar Hezaveh, Beyond Causal Discovery for Astronomy: Learning Meaningful Representations with Independent Component Analysis, arXiv:2410.14775 [astro-ph.GA], 2024. See pp. 2, 4, 10.
- Zehao Jin, Mario Pasquato, Benjamin L. Davis, Tristan Deleu, Yu Luo, Changhyun Cho, Pablo Lemos, Laurence Perreault-Levasseur, Yoshua Bengio, and Xi Kang, Causal Discovery in Astrophysics: Unraveling Supermassive Black Hole and Galaxy Coevolution, Astrophys. J. (2025) Vol. 979, 212. See 4.1.
- P. L. Krapivsky, Hiring Strategies, arXiv:2412.10490 [cs.GT], 2024. See p. 12.
- Qipeng Kuang, Ondřej Kuželka, Yuanhong Wang, and Yuyi Wang, Bridging Weighted First Order Model Counting and Graph Polynomials, arXiv:2407.11877 [cs.LO], 2024. See p. 33.
- Jack Kuipers and Giusi Moffa, Uniform generation of random acyclic digraphs, arXiv preprint arXiv:1202.6590 [stat.CO], 2012. - _N. J. A. Sloane_, Sep 14 2012
- Laphou Lao, Zecheng Li, Songlin Hou, Bin Xiao, Songtao Guo, and Yuanyuan Yang, A Survey of IoT Applications in Blockchain Systems: Architecture, Consensus and Traffic Modeling, ACM Computing Surveys (CSUR, 2020) Vol. 53, No. 1, Article No. 18.
- Tobias Ellegaard Larsen, Claus Thorn Ekstrøm, and Anne Helby Petersen, Score-Based Causal Discovery with Temporal Background Information, arXiv:2502.06232 [stat.ME], 2025. See p. 9.
- Daniel Mallia, Towards an Unsupervised Bayesian Network Pipeline for Explainable Prediction, Decision Making and Discovery, Master's Thesis, CUNY Hunter College (2023).
- B. D. McKay, F. E. Oggier, G. F. Royle, N. J. A. Sloane, I. M. Wanless and H. S. Wilf, Acyclic digraphs and eigenvalues of (0,1)-matrices, J. Integer Sequences, 7 (2004), #04.3.3.
- B. D. McKay, F. E. Oggier, G. F. Royle, N. J. A. Sloane, I. M. Wanless and H. S. Wilf, Acyclic digraphs and eigenvalues of (0,1)-matrices, arXiv:math/0310423 [math.CO], Oct 28 2003.
- A. Motzek and R. Möller, Exploiting Innocuousness in Bayesian Networks, Preprint 2015.
- Yisu Peng, Y. Jiang, and P. Radivojac, Enumerating consistent subgraphs of directed acyclic graphs: an insight into biomedical ontologies, arXiv preprint arXiv:1712.09679 [cs.DS], 2017.
- J. Peters, J. Mooij, D. Janzing, and B. Schölkopf, Causal Discovery with Continuous Additive Noise Models, arXiv preprint arXiv:1309.6779 [stat.ML], 2013.
- R. W. Robinson, Enumeration of acyclic digraphs, Manuscript. (Annotated scanned copy)
- V. I. Rodionov, On the number of labeled acyclic digraphs, Disc. Math. 105 (1-3) (1992) 319-321
- I. Shpitser, T. S. Richardson, J. M. Robins and R. Evans, Parameter and Structure Learning in Nested Markov Models, arXiv preprint arXiv:1207.5058 [stat.ML], 2012.
- I. Shpitser, R. J. Evans, T. S. Richardson, and J. M. Robins, Introduction to nested Markov models, Behaviormetrika, Behaviormetrika Vol. 41, No. 1, 2014, 3-39.
- R. P. Stanley, Acyclic orientation of graphs, Discrete Math. 5 (1973), 171-178. North Holland Publishing Company.
- Christian Toth, Christian Knoll, Franz Pernkopf, and Robert Peharz, Rao-Blackwellising Bayesian Causal Inference, arXiv:2402.14781 [cs.LG], 2024.
- Sumanth Varambally, Yi-An Ma, and Rose Yu, Discovering Mixtures of Structural Causal Models from Time Series Data, arXiv:2310.06312 [cs.LG], 2023.
- S. Wagner, Asymptotic enumeration of extensional acyclic digraphs, in Proceedings of the SIAM Meeting on Analytic Algorithmics and Combinatorics (ANALCO12).
- Daniel Waxman, Kurt Butler, and Petar M. Djuric, Dagma-DCE: Interpretable, Non-Parametric Differentiable Causal Discovery, arXiv:2401.02930 [cs.LG], 2024.
- Eric Weisstein's World of Mathematics, (0,1)-Matrix
- Eric Weisstein's World of Mathematics, Acyclic Digraph
- Eric Weisstein's World of Mathematics, Positive Eigenvalued Matrix
- Eric Weisstein's World of Mathematics, Weisstein's Conjecture
- Jun Wu and Mathias Drton, Partial Homoscedasticity in Causal Discovery with Linear Models, arXiv:2308.08959 [math.ST], 2023.
- Chris Ying, Enumerating Unique Computational Graphs via an Iterative Graph Invariant, arXiv:1902.06192 [cs.DM], 2019.
- Index entries for sequences related to binary matrices
Cf.
A055165, which counts nonsingular {0, 1} matrices and
A085656, which counts positive definite {0, 1} matrices.
These are the reverse-alternating sums of rows of
A046860.
The weakly connected case is
A082402.
-
p:=evalf(solve(sum((-1)^n*x^n/(n!*2^(n*(n-1)/2)), n=0..infinity) = 0, x), 50); M:=evalf(sum((-1)^(n+1)*p^n/((n-1)!*2^(n*(n-1)/2)), n=1..infinity), 40); # program for evaluation of constants p and M in the asymptotic formula, Vaclav Kotesovec, Dec 09 2013
-
a[0] = a[1] = 1; a[n_] := a[n] = Sum[ -(-1)^k * Binomial[n, k] * 2^(k*(n-k)) * a[n-k], {k, 1, n}]; Table[a[n], {n, 0, 13}](* Jean-François Alcover, May 21 2012, after PARI *)
Table[2^(n*(n-1)/2)*n! * SeriesCoefficient[1/Sum[(-1)^k*x^k/k!/2^(k*(k-1)/2),{k,0,n}],{x,0,n}],{n,0,20}] (* Vaclav Kotesovec, May 19 2015 *)
Table[Length[Select[Subsets[Subsets[Range[n]],{n}],Length[Select[Tuples[#],UnsameQ@@#&]]==1&]],{n,0,5}] (* Gus Wiseman, Jan 01 2024 *)
-
a(n)=if(n<1,n==0,sum(k=1,n,-(-1)^k*binomial(n,k)*2^(k*(n-k))*a(n-k)))
-
{a(n)=polcoeff(1-sum(k=0, n-1, a(k)*x^k/(1+2^k*x+x*O(x^n))^(k+1)), n)} \\ Paul D. Hanna, Oct 17 2009
A137917
a(n) is the number of unlabeled graphs on n nodes whose components are unicyclic graphs.
Original entry on oeis.org
1, 0, 0, 1, 2, 5, 14, 35, 97, 264, 733, 2034, 5728, 16101, 45595, 129327, 368093, 1049520, 2999415, 8584857, 24612114, 70652441, 203075740, 584339171, 1683151508, 4852736072, 14003298194, 40441136815, 116880901512, 338040071375, 978314772989, 2833067885748, 8208952443400
Offset: 0
From _Gus Wiseman_, Jan 25 2024: (Start)
Representatives of the a(0) = 1 through a(5) = 5 simple graphs:
{} . . {12,13,23} {12,13,14,23} {12,13,14,15,23}
{12,13,24,34} {12,13,14,23,25}
{12,13,14,23,45}
{12,13,14,25,35}
{12,13,24,35,45}
(End)
A054548 counts graphs covering n vertices with k edges, with loops
A369199.
Cf.
A000088,
A000612,
A007716,
A014068,
A053530,
A116508,
A133686,
A140638,
A368601,
A369141,
A369146.
-
Needs["Combinatorica`"];
nn=30;s[n_,k_]:=s[n,k]=a[n+1-k]+If[n<2k,0,s[n-k,k]];a[1]=1;a[n_]:=a[n]=Sum[a[i]s[n-1,i]i,{i,1,n-1}]/(n-1);rt=Table[a[i],{i,1,nn}];c=Drop[Apply[Plus,Table[Take[CoefficientList[CycleIndex[DihedralGroup[n],s]/.Table[s[j]->Table[Sum[rt[[i]]x^(k*i),{i,1,nn}],{k,1,nn}][[j]],{j,1,nn}],x],nn],{n,3,nn}]],1];CoefficientList[Series[Product[1/(1-x^i)^c[[i]],{i,1,nn-1}],{x,0,nn}],x] (* Geoffrey Critzer, Oct 12 2012, after code given by Robert A. Russell in A000081 *)
brute[m_]:=First[Sort[Table[Sort[Sort/@(m/.Rule@@@Table[{(Union@@m)[[i]],p[[i]]},{i,Length[p]}])],{p,Permutations[Range[Length[Union@@m]]]}]]];
Table[Length[Union[brute/@Select[Subsets[Subsets[Range[n],{2}],{n}],Select[Tuples[#],UnsameQ@@#&]!={}&]]],{n,0,5}] (* Gus Wiseman, Jan 25 2024 *)
A370585
Number of maximal subsets of {1..n} such that it is possible to choose a different prime factor of each element.
Original entry on oeis.org
1, 1, 1, 1, 2, 2, 5, 5, 7, 11, 25, 25, 38, 38, 84, 150, 178, 178, 235, 235, 341, 579, 1235, 1235, 1523, 1968, 4160, 4824, 6840, 6840, 9140, 9140, 10028, 16264, 33956, 48680, 56000, 56000, 116472, 186724, 223884, 223884, 290312, 290312, 403484, 484028, 1001420
Offset: 0
The a(0) = 1 through a(8) = 7 subsets:
{} {} {2} {2,3} {2,3} {2,3,5} {2,3,5} {2,3,5,7} {2,3,5,7}
{3,4} {3,4,5} {2,5,6} {2,5,6,7} {2,5,6,7}
{3,4,5} {3,4,5,7} {3,4,5,7}
{3,5,6} {3,5,6,7} {3,5,6,7}
{4,5,6} {4,5,6,7} {3,5,7,8}
{4,5,6,7}
{5,6,7,8}
Factorizations of this type are counted by
A368414, complement
A368413.
A307984 counts Q-bases of logarithms of positive integers.
A355741 counts choices of a prime factor of each prime index.
Cf.
A000040,
A000720,
A005117,
A045778,
A133686,
A333331,
A355739,
A355740,
A355744,
A355745,
A367905,
A368110.
-
Table[Length[Select[Subsets[Range[n], {PrimePi[n]}],Length[Select[Tuples[If[#==1, {},First/@FactorInteger[#]]&/@#], UnsameQ@@#&]]>0&]],{n,0,10}]
A368927
Number of labeled loop-graphs covering a subset of {1..n} such that it is possible to choose a different vertex from each edge.
Original entry on oeis.org
1, 2, 7, 39, 314, 3374, 45630, 744917, 14245978, 312182262, 7708544246, 211688132465, 6397720048692, 210975024924386, 7537162523676076, 289952739051570639, 11949100971787370300, 525142845422124145682, 24515591201199758681892, 1211486045654016217202663
Offset: 0
The a(0) = 1 through a(2) = 7 loop-graphs (loops shown as singletons):
{} {} {}
{{1}} {{1}}
{{2}}
{{1,2}}
{{1},{2}}
{{1},{1,2}}
{{2},{1,2}}
Without the choice condition we have
A006125.
The complement is counted by
A369141.
Cf.
A000169,
A000272,
A000666,
A014068,
A057500,
A116508,
A367863,
A368601,
A368924,
A368984,
A369200.
-
Table[Length[Select[Subsets[Subsets[Range[n],{1,2}]], Length[Select[Tuples[#],UnsameQ@@#&]]!=0&]],{n,0,5}]
-
seq(n)={my(t=-lambertw(-x + O(x*x^n))); Vec(serlaplace(exp(3*t/2 - 3*t^2/4)/sqrt(1-t) ))} \\ Andrew Howroyd, Feb 02 2024
A333331
Number of integer points in the convex hull in R^n of parking functions of length n.
Original entry on oeis.org
1, 3, 17, 144, 1623, 22804, 383415, 7501422
Offset: 1
For n=2 the parking functions are (1,1), (1,2), (2,1). They are the only integer points in their convex hull. For n=3, in addition to the 16 parking functions, there is the additional point (2,2,2).
- R. P. Stanley (Proposer), Problem 12191, Amer. Math. Monthly, 127:6 (2020), 563.
All of the following relative references pertain to the conjecture:
The version without the choice condition is
A014068, covering
A368597.
For any number of edges of any positive size we have
A367902.
Allowing edges of any positive size gives
A368601, complement
A368600.
Counting by singletons gives
A368924.
A003025
Number of n-node labeled acyclic digraphs with 1 out-point.
Original entry on oeis.org
1, 2, 15, 316, 16885, 2174586, 654313415, 450179768312, 696979588034313, 2398044825254021110, 18151895792052235541515, 299782788128536523836784628, 10727139906233315197412684689421
Offset: 1
a(2) = 2: o-->--o (2 ways)
a(3) = 15: o-->--o-->--o (6 ways) and
o ... o o-->--o
.\ . / . \ . /
. v v ... v v
.. o ..... o
(3 ways) (6 ways)
- R. W. Robinson, Counting labeled acyclic digraphs, pp. 239-273 of F. Harary, editor, New Directions in the Theory of Graphs. Academic Press, NY, 1973.
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
-
Table[Length[Select[Subsets[Subsets[Range[n]],{n}],Count[#,{}]==1&&Length[Select[Tuples[#],UnsameQ@@#&]]==1&]],{n,0,4}] (* _Gus Wiseman, Jan 02 2024 *)
-
\\ requires A058876.
my(T=A058876(20)); vector(#T, n, T[n][1]) \\ Andrew Howroyd, Dec 27 2021
-
\\ see Marcel et al. link (formula for a').
seq(n)={my(a=vector(n)); a[1]=1; for(n=2, #a, a[n]=sum(k=1, n-1, (-1)^(k-1) * binomial(n,k) * (2^(n-k)-1)^k * a[n-k])); a} \\ Andrew Howroyd, Jan 01 2022
A368600
Number of ways to choose a set of n nonempty subsets of {1..n} such that it is not possible to choose a different element from each.
Original entry on oeis.org
0, 0, 0, 3, 164, 18625, 5491851, 4649088885, 12219849683346
Offset: 0
The a(3) = 3 set-systems:
{{1},{2},{1,2}}
{{1},{3},{1,3}}
{{2},{3},{2,3}}
Sets of n nonempty subsets of {1..n} are counted by
A136556.
A059201 counts covering T_0 set-systems.
Cf.
A003025,
A088957,
A133686,
A334282,
A355529,
A355740,
A367862,
A367867,
A367868,
A367901,
A368094,
A368097.
-
Table[Length[Select[Subsets[Rest[Subsets[Range[n]]], {n}],Length[Select[Tuples[#], UnsameQ@@#&]]==0&]],{n,0,3}]
-
from itertools import combinations, product, chain
from scipy.special import comb
def v(c):
for elements in product(*c):
if len(set(elements)) == len(elements):
return True
return False
def a(n):
if n == 0:
return 1
subsets = list(chain.from_iterable(combinations(range(1, n + 1), r) for r in range(1, n + 1)))
cs = combinations(subsets, n)
c = sum(1 for c in cs if v(c))
return c
[print(int(comb(2**n-1,n) - a(n))) for n in range(7)] # Robert P. P. McKone, Jan 02 2024
A368984
Number of graphs with loops (symmetric relations) on n unlabeled vertices in which each connected component has an equal number of vertices and edges.
Original entry on oeis.org
1, 1, 2, 5, 12, 29, 75, 191, 504, 1339, 3610, 9800, 26881, 74118, 205706, 573514, 1606107, 4513830, 12727944, 35989960, 102026638, 289877828, 825273050, 2353794251, 6724468631, 19239746730, 55123700591, 158133959239, 454168562921, 1305796834570, 3758088009136
Offset: 0
Representatives of the a(3) = 5 graphs are:
{{1,2}, {1,3}, {2,3}},
{{1}, {1,2}, {1,3}},
{{1}, {1,2}, {2,3}},
{{1}, {2}, {2,3}},
{{1}, {2}, {3}}.
The graph with 4 vertices and edges {{1}, {2}, {1,2}, {3,4}} is included by A368599 but not by this sequence.
The case of a unique choice is
A000081.
The labeled version appears to be
A333331.
Cf.
A014068,
A057500,
A116508,
A129271,
A133686,
A367863,
A367869,
A367902,
A368597,
A368601,
A368836.
-
brute[m_]:=First[Sort[Table[Sort[Sort/@(m/.Rule@@@Table[{(Union@@m)[[i]],p[[i]]},{i,Length[p]}])],{p,Permutations[Range[Length[Union@@m]]]}]]];
Table[Length[Union[brute/@Select[Subsets[Subsets[Range[n],{1,2}],{n}],Length[Select[Tuples[#],UnsameQ@@#&]]!=0&]]],{n,0,5}] (* Gus Wiseman, Jan 25 2024 *)
A368924
Triangle read by rows where T(n,k) is the number of labeled loop-graphs on n vertices with k loops and n-k non-loops such that it is possible to choose a different vertex from each edge.
Original entry on oeis.org
1, 0, 1, 0, 2, 1, 1, 9, 6, 1, 15, 68, 48, 12, 1, 222, 720, 510, 150, 20, 1, 3670, 9738, 6825, 2180, 360, 30, 1, 68820, 159628, 110334, 36960, 6895, 735, 42, 1, 1456875, 3067320, 2090760, 721560, 145530, 17976, 1344, 56, 1, 34506640, 67512798, 45422928, 15989232, 3402756, 463680, 40908, 2268, 72, 1
Offset: 0
Triangle begins:
1
0 1
0 2 1
1 9 6 1
15 68 48 12 1
222 720 510 150 20 1
3670 9738 6825 2180 360 30 1
68820 159628 110334 36960 6895 735 42 1
Row n = 3 counts the following loop-graphs:
{{1,2},{1,3},{2,3}} {{1},{1,2},{1,3}} {{1},{2},{1,3}} {{1},{2},{3}}
{{1},{1,2},{2,3}} {{1},{2},{2,3}}
{{1},{1,3},{2,3}} {{1},{3},{1,2}}
{{2},{1,2},{1,3}} {{1},{3},{2,3}}
{{2},{1,2},{2,3}} {{2},{3},{1,2}}
{{2},{1,3},{2,3}} {{2},{3},{1,3}}
{{3},{1,2},{1,3}}
{{3},{1,2},{2,3}}
{{3},{1,3},{2,3}}
Cf.
A000169,
A057500,
A062740,
A129271,
A133686,
A322661,
A367869,
A367902,
A368601,
A368835,
A368836,
A368927.
-
Table[Length[Select[Subsets[Subsets[Range[n],{1,2}],{n}], Count[#,{_}]==k&&Length[Select[Tuples[#], UnsameQ@@#&]]!=0&]],{n,0,5},{k,0,n}]
-
T(n)={my(t=-lambertw(-x + O(x*x^n))); [Vecrev(p) | p <- Vec(serlaplace(exp(-log(1-t)/2 - t/2 + t*y - t^2/4)))]}
{ my(A=T(8)); for(i=1, #A, print(A[i])) } \\ Andrew Howroyd, Jan 14 2024
A370640
Number of maximal subsets of {1..n} such that it is possible to choose a different binary index of each element.
Original entry on oeis.org
1, 1, 1, 3, 3, 8, 17, 32, 32, 77, 144, 242, 383, 580, 843, 1201, 1201, 2694, 4614, 7096, 10219, 14186, 19070, 25207, 32791, 42160, 53329, 66993, 82811, 101963, 124381, 151286, 151286, 324695, 526866, 764438, 1038089, 1358129, 1725921, 2154668, 2640365, 3202985
Offset: 0
The a(0) = 1 through a(6) = 17 subsets:
{} {1} {1,2} {1,2} {1,2,4} {1,2,4} {1,2,4}
{1,3} {1,3,4} {1,2,5} {1,2,5}
{2,3} {2,3,4} {1,3,4} {1,2,6}
{1,3,5} {1,3,4}
{2,3,4} {1,3,5}
{2,3,5} {1,3,6}
{2,4,5} {1,4,6}
{3,4,5} {1,5,6}
{2,3,4}
{2,3,5}
{2,3,6}
{2,4,5}
{2,5,6}
{3,4,5}
{3,4,6}
{3,5,6}
{4,5,6}
The a(0) = 1 through a(6) = 17 set-systems:
{1} {1}{2} {1}{2} {1}{2}{3} {1}{2}{3} {1}{2}{3}
{1}{12} {1}{12}{3} {1}{12}{3} {1}{12}{3}
{2}{12} {2}{12}{3} {1}{2}{13} {1}{2}{13}
{2}{12}{3} {1}{2}{23}
{2}{3}{13} {1}{3}{23}
{1}{12}{13} {2}{12}{3}
{12}{3}{13} {2}{3}{13}
{2}{12}{13} {1}{12}{13}
{1}{12}{23}
{1}{13}{23}
{12}{3}{13}
{12}{3}{23}
{2}{12}{13}
{2}{12}{23}
{2}{13}{23}
{3}{13}{23}
{12}{13}{23}
The case of a unique choice is
A370638.
A070939 gives length of binary expansion.
A096111 gives product of binary indices.
A307984 counts Q-bases of logarithms of positive integers.
A355741 counts choices of a prime factor of each prime index.
-
bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
Table[Length[Select[Subsets[Range[n],{IntegerLength[n,2]}], Select[Tuples[bpe/@#],UnsameQ@@#&]!={}&]],{n,0,10}]
-
lista(nn) = my(b, m=Map(Mat([[[]], 1])), t, u, v, w, z); for(n=0, nn, t=Mat(m)~; b=Vecrev(binary(n)); u=select(i->b[i], [1..#b]); for(i=1, #t, v=t[1, i]; w=List([]); for(j=1, #v, for(k=1, #u, if(!setsearch(v[j], u[k]), listput(w, setunion(v[j], [u[k]]))))); w=Set(w); if(#w, z=0; mapisdefined(m, w, &z); mapput(m, w, z+t[2, i]))); print1(mapget(m, [[1..#b]]), ", ")); \\ Jinyuan Wang, Mar 28 2025
Showing 1-10 of 16 results.
Comments