We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I find it helped to alias mp2 as neededForDoublets and mp3 as neededForTriplets. Once I did this, the logic clicked. Given the value 2 for this iteration with an r of 3, we'd need a 6 (2 * r) to form doublet(s). If we find that 6 in a subsequent iteration, then we increase the possible number of triplets for 18 (6 * r) by the - now known - number of doublets - (2, 6). We need an 18 here people! If we find 18 on a subsequent iteration, we now know we have the triplets we flagged as possible in the previous step, so we can add them to the triplet count.
Count Triplets
You are viewing a single comment's thread. Return to all comments →
I find it helped to alias
mp2
asneededForDoublets
andmp3
asneededForTriplets
. Once I did this, the logic clicked. Given the value 2 for this iteration with anr
of 3, we'd need a 6 (2 * r) to form doublet(s). If we find that 6 in a subsequent iteration, then we increase the possible number of triplets for 18 (6 * r) by the - now known - number of doublets - (2, 6). We need an 18 here people! If we find 18 on a subsequent iteration, we now know we have the triplets we flagged as possible in the previous step, so we can add them to the triplet count.