Pascal's triangle/Puzzle: Difference between revisions
→Algebraic solution
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]:
<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)
</syntaxhighlight>
This gives the solution for [x,z] as:
|