KPrimes challenge ! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

KPrimes challenge !

A k-prime is a number having k prime factors ex 2 3 5 7 11 are 1-primes 4 6 9 are 2 primes 8 12 18 are 3 primes Program a function telling if n is a k prime or not

26th Jan 2018, 1:05 PM
VcC
VcC - avatar
4 Answers
+ 3
Here It goes, I think It is too slow and simple compared to your crazy algorithms but It works =D https://code.sololearn.com/cpriajD2HyRN/?ref=app
26th Jan 2018, 2:28 PM
Lucas Pardo
Lucas Pardo - avatar
+ 2
you won it. oneliner alternative here https://code.sololearn.com/c43v1uUIguLo/?ref=app
28th Jan 2018, 10:55 AM
VcC
VcC - avatar
0
Good !
26th Jan 2018, 7:52 PM
VcC
VcC - avatar
0
Holy shit, forgot to add n += 2 to the generator, thats why It didnt work for some numbers lol, now It works perfectly
26th Jan 2018, 8:02 PM
Lucas Pardo
Lucas Pardo - avatar