3 ms·
You don't need to append 'p' in the inner while loop more than once. Maybe instead of an array for keeping the list of prime factors do it in a set.
by kenjackson 2y ago
You don't need to append 'p' in the inner while loop more than once. Maybe instead of an array for keeping the list of prime factors do it in a set.
- zeroonetwothree 2y agoIt’s valid to return the multiplicity of each prime, depending on the goal of this.
- justinpombrio 2y agohttps://www.wolframalpha.com/input?i=prime+factors+of+12 https://www.wolframalpha.com/input?i=prime+factors+of+12