Talk:4-rings or 4-squares puzzle: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "=Why 2860?= The equations are: a+b=X b+c+d=X d+e+f=X f+g=X which imply that d = a-c and d = g-e when d=9 the only values are a=9, c=0 when d=8 the values ar...")
 
No edit summary
Line 1: Line 1:
=Why 2860?=
=Why 2860?=
<pre>
The equations are:
The equations are:
a+b=X
a+b=X
Line 24: Line 25:
d=8 Z8 = 38 -> 2*1 + 2*1*1 + 7*2*2
d=8 Z8 = 38 -> 2*1 + 2*1*1 + 7*2*2
d=7 Z7
d=7 Z7
</pre>

Revision as of 17:39, 25 January 2017

Why 2860?

The equations are:
 a+b=X
 b+c+d=X
 d+e+f=X
 f+g=X

which imply that d = a-c
             and d = g-e

when d=9 the only values are a=9, c=0
when d=8 the values are a=9, c=1; a=8, c=0.
which for d=0..9 sums to 55.

So there are 55*55 cases to consider for a, c, d, e, and g.
Fixing b fixes f so it should not be necessary to consider more than 55*55*10 (which is 25250) cases, which is rather less than the permutations that some solutions are testing!

The task is to determine the number of solutions that there are, for which I need to go a little further.

X must have a minimum value of d when b,c,e,f=0 and a maximum value of 18 when a,b=9.
For d=0..9 I generate something Pascal Triangle like for the count Z of solutions:

d=9 Z9 = 10 -> 2*1 + 8*1*1
d=8 Z8 = 38 -> 2*1 + 2*1*1 + 7*2*2
d=7 Z7