+ 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👍
14 Respostas
+ 15
#Ruby
require "prime"
q = 1
Prime.each(gets.to_i) do |p|
q *= p
end
puts q
+ 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
+ 7
That's literally the convenience of ruby.
+ 5
i tried my best...
https://code.sololearn.com/cqxTvpcMJhw4/?ref=app
+ 4
I can modify one of my codes for this :)
+ 4
Here my answer, I am using 3 different ways to sum products of primes:
https://code.sololearn.com/c1Sk9AZLHBdF/?ref=app
+ 3
there is py module fr primes
..
gmpy2 and sympy
## not supported here thats a problem...
+ 3
this is quite a efficient way to generate primes....without any module
https://code.sololearn.com/cmSkuqU5z7De/?ref=app
+ 3
Java solution :
https://code.sololearn.com/c6PJvJMKe6S9/?ref=app
+ 3
This one better for large numbers using Pollard' s algo
https://code.sololearn.com/cU9K9ia897vz/?ref=app
+ 2
+ 2
https://code.sololearn.com/cZo7y4VVqSJJ/?ref=app
+ 1
Approximatively exp(n)