You are not logged in.
Pages: 1
19 year old, second year mechanical engineer, have basic knowledge in C++, music addict, and that's about it I guess.
I've been trying for a week now to join this forum...couldn't get passed that signup challenge which requires a very simple straight to the point program which I did but wouldn't work, which was really frustrating. Today, I said I'll give it another try and voila ! it worked ! Still not sure why it didn't work in the first place.
Anyway, in my opinion this is a great forum and I'm very interested with the content and friendly users.
Looking forward to meeting you all.
Cheers !
Hey, you can PM me the code of the signup thing so I can tell you what's wrong with it.
What university are you in?
And welcome!
Sent !
Oh, when I signed up it was an easy math question ! What's that new challenge ?
Find the sum of the multiples of 3 or 5 under 533
For example, if we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Welcome ! About the entrance challenge , the thing is that you don't have to take the same multiples of the two numbers two times , it took me 15 min to realize it :)
Welcome ! About the entrance challenge , the thing is that you don't have to take the same multiples of the two numbers two times , it took me 15 min to realize it :)
I realized this also, however, as I said it wouldn't work. After a while I said I'd give it another try and it worked.
I'm glad I joined before this challenge was implemented, otherwise I would never have been able to join!
Last edited by rolf (June 26 2014)
I guess this challenge can be solved algebraically without the need of a program.
-
Last edited by RoyNm (last month)
-
Last edited by RoyNm (last month)
To find the sum of multiples of m (not 0) less or equal to n:
Let c = n mod m
S(m,n) = Sum for i=0 -> i=(n-c)/m of m*i
S(m,n) = m * Sum for i=0 -> i=(n-c)/m of i
S(m,n) = m * (n-c)/m * ((n-c)/m + 1) / 2
S(m,n) = (n-c) * (n-c+m) / 2 / m
We have now a formula to get the sum of the multiples.
Now the final result is S(m1,n) + S(m2,n) - S(m3,n) where m3 is the lcm of m1 and m2.
Didn't really test the result though.
Welcome thetruth to lebgeeks!
Me, I used excel to sign up because I'm still in school and I know absolutely nothing about coding
Turns out that the common multiples between the 2 numbers should be counted once. that's why they said the first number or the second number.
To find the sum of multiples of m (not 0) less or equal to n:
Let c = n mod m
S(m,n) = Sum for i=0 -> i=(n-c)/m of m*i
S(m,n) = m * Sum for i=0 -> i=(n-c)/m of i
S(m,n) = m * (n-c)/m * ((n-c)/m + 1) / 2
S(m,n) = (n-c) * (n-c+m) / 2 / m
We have now a formula to get the sum of the multiples.Now the final result is S(m1,n) + S(m2,n) - S(m3,n) where m3 is the lcm of m1 and m2.
Didn't really test the result though.
c(3, 532) = 532 mod 3 = 1
S(3, 532) = (532-1) * (532-1+3) / 2 / 3 = 47259
c(5, 532) = 532 mod 5 = 2
S(5, 532) = (532-2) * (532-2+5) / 2 / 5 = 28355
c(15, 532) = 532 mod 15 = 7
S(15, 532) = (532-7) * (532-7+15) / 2 / 15 = 9450
The rest is left as an exercise for the reader.
Thetruth, i got here using basic google skills while on my lunch break at work.. Well it might have taken a little bit more that the lunch break but oh well i know i will not be winning employee of the month award anytime soon
Pages: 1