I've been battling with this for HOURS and I am completely stuck.
I'm randomly generating numbers and finding their prime factors. For example...
Prime Factors of 420: 2, 2, 3, 5, 7
Prime Factors of 690: 2, 3, 5, 23
I want to highlight the matching pairs and "uncommon" factors separately as I list them out. So, in this case I would want something like...
Prime Factors of 420: 2, 2, 3, 5, 7
Prime Factors of 690: 2, 3, 5, 23
Then the other 2 and the 7 from 420, and the 23 from 690 would be highlighted in red (for example).
I already have the lists of prime factors in arrays ($factor_list_1_old
and $factor_list_2_old
respectively). I also have the list of common factors in an array ($commons
) and a list of the uncommon factors in an array ($uncommons
).
I've tried many ways of doing this and nothing seems to work for all scenarios. I can get this scenario to work, but then it fails for something like 420 and 780.
Any ideas?