So for example: This is obviously not the most efficient implementation for one it iterates over the whole set of natural numbers, instead of going straight for the primes but it's good enough for relatively small values, and simple enough that it can be easily understood. 42 x 11 = 462 You put the number that is on the 10's place in the factor that is being multiplied by 11 (which is 4) to the hundreds place in the multiple. If I change the code to build a list instead, it slows down slightly: I believe that the tricky generator functions version is the fastest possible in Python. No. {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/2\/2e\/Factor-a-Number-Step-1-Version-4.jpg\/v4-460px-Factor-a-Number-Step-1-Version-4.jpg","bigUrl":"\/images\/thumb\/2\/2e\/Factor-a-Number-Step-1-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-1-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a> License: Creative Commons<\/a>
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/e\/ef\/Factor-a-Number-Step-2-Version-3.jpg\/v4-460px-Factor-a-Number-Step-2-Version-3.jpg","bigUrl":"\/images\/thumb\/e\/ef\/Factor-a-Number-Step-2-Version-3.jpg\/aid40992-v4-728px-Factor-a-Number-Step-2-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/f\/f8\/Factor-a-Number-Step-3-Version-3.jpg\/v4-460px-Factor-a-Number-Step-3-Version-3.jpg","bigUrl":"\/images\/thumb\/f\/f8\/Factor-a-Number-Step-3-Version-3.jpg\/aid40992-v4-728px-Factor-a-Number-Step-3-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/4\/46\/Factor-a-Number-Step-4-Version-4.jpg\/v4-460px-Factor-a-Number-Step-4-Version-4.jpg","bigUrl":"\/images\/thumb\/4\/46\/Factor-a-Number-Step-4-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-4-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/c\/ce\/Factor-a-Number-Step-5-Version-4.jpg\/v4-460px-Factor-a-Number-Step-5-Version-4.jpg","bigUrl":"\/images\/thumb\/c\/ce\/Factor-a-Number-Step-5-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-5-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/7\/7b\/Factor-a-Number-Step-6-Version-4.jpg\/v4-460px-Factor-a-Number-Step-6-Version-4.jpg","bigUrl":"\/images\/thumb\/7\/7b\/Factor-a-Number-Step-6-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-6-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/a\/a5\/Factor-a-Number-Step-7-Version-4.jpg\/v4-460px-Factor-a-Number-Step-7-Version-4.jpg","bigUrl":"\/images\/thumb\/a\/a5\/Factor-a-Number-Step-7-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-7-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/7\/72\/Factor-a-Number-Step-8-Version-4.jpg\/v4-460px-Factor-a-Number-Step-8-Version-4.jpg","bigUrl":"\/images\/thumb\/7\/72\/Factor-a-Number-Step-8-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-8-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/c\/c5\/Factor-a-Number-Step-9-Version-4.jpg\/v4-460px-Factor-a-Number-Step-9-Version-4.jpg","bigUrl":"\/images\/thumb\/c\/c5\/Factor-a-Number-Step-9-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-9-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/3\/32\/Factor-a-Number-Step-10-Version-4.jpg\/v4-460px-Factor-a-Number-Step-10-Version-4.jpg","bigUrl":"\/images\/thumb\/3\/32\/Factor-a-Number-Step-10-Version-4.jpg\/aid40992-v4-728px-Factor-a-Number-Step-10-Version-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/6\/6b\/Factor-a-Number-Step-11-Version-3.jpg\/v4-460px-Factor-a-Number-Step-11-Version-3.jpg","bigUrl":"\/images\/thumb\/6\/6b\/Factor-a-Number-Step-11-Version-3.jpg\/aid40992-v4-728px-Factor-a-Number-Step-11-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"
\n<\/p>
\n<\/p><\/div>"}. I'd personally implement this as a method returning an IEnumerable