Originally posted by TimberWolf
View Post
of Sterling's expansion
of
(2pi)^0.5 . n ^ (n^2+1) ----------------------- (2pi.n)^(n/2)
with n as ( select '1' as n union all select '2' as n union all select '3' as n ) , r as ( select n1.n c1, n2.n c2, n3.n c3 from n n1 cross join n n2 cross join n n3 where cast(n1.n as int) + cast(n2.n as int) + cast(n3.n as int) = 6 ) select r1.c1 as r1c1,r1.c2 as r1c2, r1.c3 as r1c3, r2.c1 as r2c1,r2.c2 as r2c2, r2.c3 as r2c3, r3.c1 as r3c1,r3.c2 as r3c2, r3.c3 as r3c3 from r r1 cross join r r2 cross join r r3 where len(replace( r1.c1+r1.c2+r1.c3+ r2.c1+r2.c2+r2.c3+ r3.c1+r3.c2+r3.c3, '1', '')) = 6 and len(replace( r1.c1+r1.c2+r1.c3+ r2.c1+r2.c2+r2.c3+ r3.c1+r3.c2+r3.c3, '2', '')) = 6 and len(replace( r1.c1+r1.c2+r1.c3+ r2.c1+r2.c2+r2.c3+ r3.c1+r3.c2+r3.c3, '3', '')) = 6 and cast(r1.c1 as int) + CAST(r2.c2 as int) + CAST(r3.c3 as int) = 6 and cast(r1.c3 as int) + CAST(r2.c2 as int) + CAST(r3.c1 as int) = 6 and cast(r1.c1 as int) + CAST(r2.c1 as int) + CAST(r3.c1 as int) = 6 and cast(r1.c2 as int) + CAST(r2.c2 as int) + CAST(r3.c2 as int) = 6 and cast(r1.c3 as int) + CAST(r2.c3 as int) + CAST(r3.c3 as int) = 6
with n as ( select '1' as n union all select '2' as n union all select '3' as n union all select '4' as n union all select '5' as n ) , r as ( select n1.n c1, n2.n c2, n3.n c3, n4.n c4, n5.n c5 from n n1 cross join n n2 cross join n n3 cross join n n4 cross join n n5 where cast(n1.n as int) + cast(n2.n as int) + cast(n3.n as int) + cast(n4.n as int) + cast(n5.n as int) = 15 ) select r1.c1 as r1c1,r1.c2 as r1c2, r1.c3 as r1c3, r1.c4 as r1c4, r1.c5 as r1c5, r2.c1 as r2c1,r2.c2 as r2c2, r2.c3 as r2c3, r2.c4 as r2c4, r2.c5 as r2c5, r3.c1 as r3c1,r3.c2 as r3c2, r3.c3 as r3c3, r3.c4 as r3c4, r3.c5 as r3c5, r4.c1 as r4c1,r4.c2 as r4c2, r4.c3 as r4c3, r4.c4 as r4c4, r4.c5 as r1c5, r5.c1 as r5c1,r5.c2 as r5c2, r5.c3 as r5c3, r5.c4 as r5c4, r5.c5 as r1c5 from r r1 cross join r r2 cross join r r3 cross join r r4 cross join r r5 where len(replace( r1.c1+r1.c2+r1.c3+r1.c4+r1.c5+ r2.c1+r2.c2+r2.c3+r2.c4+r2.c5+ r3.c1+r3.c2+r3.c3+r3.c4+r3.c5+ r4.c1+r4.c2+r4.c3+r4.c4+r4.c5+ r5.c1+r5.c2+r5.c3+r5.c4+r5.c5, '1', '')) = 20 and len(replace( r1.c1+r1.c2+r1.c3+r1.c4+r1.c5+ r2.c1+r2.c2+r2.c3+r2.c4+r2.c5+ r3.c1+r3.c2+r3.c3+r3.c4+r3.c5+ r4.c1+r4.c2+r4.c3+r4.c4+r4.c5+ r5.c1+r5.c2+r5.c3+r5.c4+r5.c5, '2', '')) = 20 and len(replace( r1.c1+r1.c2+r1.c3+r1.c4+r1.c5+ r2.c1+r2.c2+r2.c3+r2.c4+r2.c5+ r3.c1+r3.c2+r3.c3+r3.c4+r3.c5+ r4.c1+r4.c2+r4.c3+r4.c4+r4.c5+ r5.c1+r5.c2+r5.c3+r5.c4+r5.c5, '3', '')) = 20 and len(replace( r1.c1+r1.c2+r1.c3+r1.c4+r1.c5+ r2.c1+r2.c2+r2.c3+r2.c4+r2.c5+ r3.c1+r3.c2+r3.c3+r3.c4+r3.c5+ r4.c1+r4.c2+r4.c3+r4.c4+r4.c5+ r5.c1+r5.c2+r5.c3+r5.c4+r5.c5, '4', '')) = 20 and len(replace( r1.c1+r1.c2+r1.c3+r1.c4+r1.c5+ r2.c1+r2.c2+r2.c3+r2.c4+r2.c5+ r3.c1+r3.c2+r3.c3+r3.c4+r3.c5+ r4.c1+r4.c2+r4.c3+r4.c4+r4.c5+ r5.c1+r5.c2+r5.c3+r5.c4+r5.c5, '5', '')) = 20 and cast(r1.c1 as int) + CAST(r2.c2 as int) + CAST(r3.c3 as int) + CAST(r4.c4 as int) + CAST(r5.c5 as int) = 15 and cast(r1.c5 as int) + CAST(r2.c4 as int) + CAST(r3.c3 as int) + CAST(r4.c2 as int) + CAST(r5.c1 as int) = 15 and cast(r1.c1 as int) + CAST(r2.c1 as int) + CAST(r3.c1 as int) + CAST(r4.c1 as int) + CAST(r5.c1 as int) = 15 and cast(r1.c2 as int) + CAST(r2.c2 as int) + CAST(r3.c2 as int) + CAST(r4.c2 as int) + CAST(r5.c2 as int) = 15 and cast(r1.c3 as int) + CAST(r2.c3 as int) + CAST(r3.c3 as int) + CAST(r4.c3 as int) + CAST(r5.c3 as int) = 15 and cast(r1.c4 as int) + CAST(r2.c4 as int) + CAST(r3.c4 as int) + CAST(r4.c4 as int) + CAST(r5.c4 as int) = 15 and cast(r1.c5 as int) + CAST(r2.c5 as int) + CAST(r3.c5 as int) + CAST(r4.c5 as int) + CAST(r5.c5 as int) = 15
n solutions unique combinations col3 / col 2 1 1 1 1 in 1 2 0 6 undefined 3 4 1680 1 in 420 4 256 6 * 10^7 1 in 3/4 million 5 836,864 6 * 10^14 1 in 740 million
(2pi)^0.5 . n ^ (n^2+1) ----------------------- (2pi.n)^(n/2)
n! = SQRT(2 PI n) (n / e)^n (1 + 1 / (12 n))
(2pi)^0.5 . n ^ (n^2+1) ----------------------- (2pi.n)^(n/2)
a11 a12 a13 a14 a15 a16 a21 a22 a23 a24 a25 a26 a31 a32 a33 a34 a35 a36 a41 a42 a43 a44 a45 a46 a51 a52 a53 a54 a55 a56 a61 a62 a63 a64 a65 a66
b11 b12 b13 b14 b15 b16 b21 b22 b23 b24 b25 b26 b31 b32 b33 b34 b35 b36 b31 b32 b33 b34 b35 b36 b21 b22 b23 b24 b25 b26 b11 b12 b13 b14 b15 b16
c11 c12 c13 c13 c12 c11 c21 c22 c23 c23 c22 c21 c31 c32 c33 c33 c32 c31 c31 c32 c33 c33 c32 c31 c21 c22 c23 c23 c22 c21 c11 c12 c13 c13 c12 c11
2 c11 d12 d13 d13 d12 d11 d12 2 c22 d23 d23 d22 d12 d13 d23 2 c33 d33 d23 d13 d13 d23 d33 2 c33 d23 d13 d12 d22 d23 d23 2 c22 d12 d11 d12 d13 d13 d12 2 c11
Table Rows sum Platypus Solutions size to number 1*1 1 1 0 (or 1) 2*2 3 2 0 3*3 6 7 4 4*4 10 44 256 5*5 15 381 836,864 6*6 21 4,332 ? 7*7 28 60,691 ?
Leave a comment: