Pascal's triangle/Puzzle: Difference between revisions

Line 1,750:
where a and b are the known values at the base.
 
Using the jq program at [[Cramer%27s_rule#jq|Cramer's rule]], with the unknown vector being [x, z]:
Plugging in the known values yields:
<pre>
151 = 4 * 15 + 7(x+z)
40 = 2x + 22 + z
</pre>
i.e.
<pre>
13 = x +z
18 = 2x+z
</pre>
 
These two occasions can solved trivially, but for fun, let's use the linear equation solver
at [[Cramer%27s_rule#jq]]:
<syntaxhighlight lang=jq>
include "rc-cramers-rule";
def solve(top; mid; a; b):
cramer(
[ [7, 7],
[2, 1]];
[top - 4*(a+b), mid-2*a]);
 
solve(151; 40; 11; 4)
cramer([[1,1], [2,1]] ; [13, 18])
</syntaxhighlight>
This gives the solution for [x,z] as:
2,479

edits