December 12th, 2012, 12:19 AM  #1 
Newbie Joined: Dec 2012 Posts: 6 Thanks: 0  multiples
i have k numbers say 3. say 2, 4 ,5, i have a "n" and i need to tell how many total mutilples of 2 , 4 ,5 exist till n. for ex, till n=10, 2 , 4 ,5 , 6, 8, 10 exist . So my answer if 6 here. how to go for this question ? thanks 
December 12th, 2012, 03:17 AM  #2 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: multiples
4 is a multiple of 2, so every multiple of 4 is a multiple of 2. So there are floor(n / 2) + floor(n / 5)  floor(n / 10) multiples of 2, 4 and 5 up to n. subtract floor(n / 10) because multiples of 10 are counted twice; as a multiple of 2 as well as a multiple of 5. 
December 13th, 2012, 11:36 PM  #3 
Newbie Joined: Dec 2012 Posts: 6 Thanks: 0  Re: multiples
how can i generalize it any n and any k numbers given ? it is speical case u have explained. i want to generalize it some how... thanks

December 14th, 2012, 12:36 AM  #4 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: multiples
I'd investigate what special cases you might find and how to handle them. For a start, how many numbers are multiples of eighter 4, 5 or 6 and <= 300

December 14th, 2012, 03:19 AM  #5 
Newbie Joined: Dec 2012 Posts: 6 Thanks: 0  Re: multiples
i can do for these questions while working on pen and paper. but how to generalize this thing. that's the main point. thanks

December 14th, 2012, 04:04 AM  #6 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: multiples
You first need to know how many of these numbers are multiples of 4, 5 and 6. Can you do that? Adding them yields that some are counted more than once, for example 12, 24 etc. Which are counted more than once? How to find them?

December 14th, 2012, 05:17 AM  #7 
Newbie Joined: Dec 2012 Posts: 6 Thanks: 0  Re: multiples
exactly! i need that thing. on paper, yes i can do. but i wana code it and have a generalized version if it. my brain knows how to do it. how to tell in the ocde to computer that you must o/p this way ?

December 14th, 2012, 05:43 AM  #8 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: multiples
Could you explain what your brain does? What is ocde and o/p?

December 14th, 2012, 05:55 AM  #9 
Newbie Joined: Dec 2012 Posts: 6 Thanks: 0  Re: multiples
that was miss written. it was "code" , secondly, o/p means output. thirdly, do u want to write the whole process how will i proceed for ur example. right ?

December 14th, 2012, 06:11 AM  #10 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: multiples
Ah, got it, Thanks. I'd like to understand how you work. Choose what you think you can do best to have me understand what you want. If I don't understand, I'll ask for clarification. What programming language are you using? 

Tags 
multiples 
Search tags for this page 
Click on a term to search for related topics.

Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Common multiples of two numbers  md9  Abstract Algebra  1  May 10th, 2013 02:26 PM 
why is my function so stable at multiples of 22?  mark212  Algebra  5  April 10th, 2012 10:06 PM 
converting multiples  Tylerman  Applied Math  4  January 30th, 2012 02:15 PM 
multiples of 2 pi  Icevox  Number Theory  8  March 25th, 2011 02:11 PM 