🏆Challenge #11: To find product of all primes to a number n🏆 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

🏆Challenge #11: To find product of all primes to a number n🏆

To find product of every prime number to a number took as input For eg. Input = 6 Output = 2*3*5 = 30 Any language👍

5th Nov 2017, 4:55 AM
#RahulVerma
#RahulVerma - avatar
14 Answers
5th Nov 2017, 5:16 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 15
#Ruby require "prime" q = 1 Prime.each(gets.to_i) do |p| q *= p end puts q
5th Nov 2017, 5:25 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 14
Here's my C# implementation! ✌ I'm kinda occupied recently but decided to make it in my favourite LINQ as I've invited by someone to complete the challenge. Enjoy~ ❤ https://code.sololearn.com/cDpGJBV8JmCU/?ref=app
5th Nov 2017, 3:25 PM
Zephyr Koo
Zephyr Koo - avatar
+ 7
That's literally the convenience of ruby.
5th Nov 2017, 5:32 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
13th Nov 2017, 5:23 AM
SAKSHI
SAKSHI - avatar
+ 4
I can modify one of my codes for this :)
5th Nov 2017, 5:13 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Here my answer, I am using 3 different ways to sum products of primes: https://code.sololearn.com/c1Sk9AZLHBdF/?ref=app
5th Nov 2017, 3:44 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 3
there is py module fr primes .. gmpy2 and sympy ## not supported here thats a problem...
5th Nov 2017, 6:11 AM
sayan chandra
sayan chandra - avatar
+ 3
this is quite a efficient way to generate primes....without any module https://code.sololearn.com/cmSkuqU5z7De/?ref=app
5th Nov 2017, 6:23 AM
sayan chandra
sayan chandra - avatar
6th Nov 2017, 1:07 AM
Takava Lim
Takava Lim - avatar
+ 3
This one better for large numbers using Pollard' s algo https://code.sololearn.com/cU9K9ia897vz/?ref=app
30th Dec 2017, 9:59 PM
VcC
VcC - avatar
5th Nov 2017, 10:40 AM
VcC
VcC - avatar
+ 2
https://code.sololearn.com/cZo7y4VVqSJJ/?ref=app
30th Dec 2017, 9:08 PM
VcC
VcC - avatar
+ 1
Approximatively exp(n)
5th Nov 2017, 7:13 AM
VcC
VcC - avatar