I've been noodling around with primitive Pythagorean triples. One of the 'branches' of the ternary tree that generates all possible PPTs from the initial parent PPT 3,4,5
is given by
Subscript[a, i + 1] =
Subscript[a, i] - 2*Subscript[b, i] + 2*Subscript[c, i];
Subscript[b, i + 1] =
2*Subscript[a, i] - Subscript[b, i] + 2*Subscript[c, i];
Subscript[c, i + 1] =
2*Subscript[a, i] - 2*Subscript[b, i] + 3*Subscript[c, i];
I want to make a table where each row of 3
numbers, starting with the (given) root PPT Subscript[a, 1]=3,Subscript[b, 1]=4,Subscript[c, 1]=5
, is produced by the application of those formulas to the row immediately preceding so that {3,4,5}->{5,12,13}->{7,24,25}->{9,40,41}
etc, giving
table={{3,4,5},{5,12,13},{7,24,25},{9,40,41},{...}}
How do I do this?
NestList
. $\endgroup$NestList
is doing in principle, but not sure how to make it into theTable
I'm after.a = 3; b = 4; c = 5; NestList[{a - 2 b + 2 c, 2 a - b + 2 c, 2 a - 2 b + 3 c} &, 0, 4]
just produces strings of identical digits, for example. $\endgroup$NestList[{#[[1]]-2#[[2]]+2#[[3]],2#[[1]]-#[[2]]+2#[[3]],2#[[1]]-2#[[2]]+3#[[3]]}&,{3,4,5},3]
$\endgroup$#
yet, but if it ain't broke... Thanks @J42161217. (Got it now!) $\endgroup$