+ 15
CHALLENGE✋: Integers, roots and division
The point is to: Find all the positive integers "n" that are divisible by all the positive integers not larger than the square root of n. Any language is welcomed.
28 odpowiedzi
+ 11
Odd. The question made perfect sense to me. At least this is how I interpreted it.
*Remember to take heed for cases 0 and 1. :>
https://code.sololearn.com/cyLCMBAHgdg4/?ref=app
+ 18
recursion only ☺
//a modification can be made to improve code but'll increase the size of code
https://code.sololearn.com/cBLVKqmodgX9/?ref=app
+ 17
(x Ɛ Z : 0 < x < ∞) where x % [1, [(√x)]] == 0 , [.] denotes greatest integer function & and % denotes modulus operator(which we use in java 😂)
//in math we state it like this
@blackcat1111
/*it would be wrong to say that 0 is included in set of +ve numbers , u can 0 is included in set of non negative numbers */
+ 16
guys are u all out of the confusion that why 24 is maximum , if not then u can see this link ☺👍
https://publish.pothi.com/preview/?sku=ebook3477
+ 14
https://code.sololearn.com/c40R8yE5I1v9/?ref=app
+ 7
@blackcat1111
Absolutely. Unless you haven't understand the challenge properly, or I haven't been clear enough while explaining...
+ 7
@Martin
An example: 32 is not a solution because sqrt(32)=5.something, so 32 has to be divisible by 1, 2, 3, 4 and 5. But 32%5 or 32%3 is not 0. Did you get it now??
+ 7
@Guarav Agrawal Sorry, haven't done math in two months 😉
+ 5
Based on my understanding of your question:
https://code.sololearn.com/cGuulwT0K3Li/?ref=app
+ 5
https://code.sololearn.com/clf0JFFUjFbT/?ref=app
+ 4
All? You are sure there is not an infinite quantity of such?
+ 4
@Ledio Deda I shall rephrase the question; please tell me if I am wrong.
Find all positive integers (x Ɛ Z : 0 ≤ x < ∞) where
x MOD (1.. INT(√x)) == 0.
+ 4
Well
@Hatsy Rei found them🎉🎉...
Other ways of solution expected...
+ 4
@blackcat
✅Correct, but in order to avoid time limit exceeded, you can follow a simple maths algorythm to find the larges possible integer "n" who can satisfy the condition...
+ 4
@VcC
Yes, but that kp must be less or equal than sqrt(n).
Got it???
+ 4
@yerucham
Absolutely correct!!!👏👏
The only advice is to find the largest possible solution and put the limit to that nr and not 100000.
But that is optional...👍
+ 4
Well, I would let it turn as an infinite loop, to keep the initial logic ... if the thing has to be used as a checker, one shouldn't stop it unless he knows the answer. But the code playground here doesn't like it.
https://code.sololearn.com/cJmR8F49KA0X/#py
+ 4
https://code.sololearn.com/crqZak5WxYed/?ref=app
+ 3
@Ledio Deda Thanks for the tip! It was actually pretty easy. Fixed my code now.
[Spoilers Alert]
Consider the largest number p satisfying the conditions where p MOD (0..q], where q = int(√p).
Following the definition of q, p must be q! as p is the largest number satisfying the conditions.
Therefore: p = q! where q = int(√p).
Hence the largest number is 24.