I am trying to compute a list of prime factors of the factorial of n, with the prime factors sorted in increasing order and with each in this list exactly as many times as it would appear in the prime factorization of the factorial.
I have a program that computes a linkedlist of prime numbers up to a specified number, but I'm not sure how to implement that while appending the prime factors of the integer that is currently being multiplied into the factorial: