LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 April 5 2014

thetruth
Member

Finally!

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 !

Offline

#2 April 5 2014

Johnaudi
Member

Re: Finally!

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!

Offline

#3 April 5 2014

thetruth
Member

Re: Finally!

Sent !

Offline

#4 April 5 2014

Adnan
Member

Re: Finally!

Oh, when I signed up it was an easy math question ! What's that new challenge ?

Offline

#5 April 5 2014

nosense
Member

Re: Finally!

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.

Offline

#6 April 6 2014

Freddy98
Member

Re: Finally!

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 :)

Offline

#7 April 7 2014

thetruth
Member

Re: Finally!

Freddy98 wrote:

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.

Offline

#8 June 26 2014

rolf
Member

Re: Finally!

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)

Offline

#9 June 26 2014

InVader
Member

Re: Finally!

I guess this challenge can be solved algebraically without the need of a program.

Offline

#10 June 27 2014

RoyNm
Member

Re: Finally!

-

Last edited by RoyNm (3 weeks ago)

Offline

#11 June 27 2014

RoyNm
Member

Re: Finally!

-

Last edited by RoyNm (3 weeks ago)

Offline

#12 June 27 2014

InVader
Member

Re: Finally!

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.

Offline

#13 June 28 2014

charbel316
Member

Re: Finally!

Welcome thetruth to lebgeeks!
Me, I used excel to sign up because I'm still in school and I know absolutely nothing about coding

Offline

#14 July 9 2014

Tikamak
Member

Re: Finally!

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.

Offline

#15 July 9 2014

InVader
Member

Re: Finally!

InVader wrote:

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.

Offline

#16 December 10 2014

Tutenkhamun
Member

Re: Finally!

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

Offline

Board footer