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
Cookies help us deliver our services. By using our services, you agree to our use of cookies.