My Math Forum  

Go Back   My Math Forum > College Math Forum > Number Theory

Number Theory Number Theory Math Forum


Reply
 
LinkBack Thread Tools Display Modes
December 11th, 2012, 11:19 PM   #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
nitin1 is offline  
 
December 12th, 2012, 02: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.
Hoempa is offline  
December 13th, 2012, 10: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
nitin1 is offline  
December 13th, 2012, 11:36 PM   #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
Hoempa is offline  
December 14th, 2012, 02: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
nitin1 is offline  
December 14th, 2012, 03: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?
Hoempa is offline  
December 14th, 2012, 04: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 ?
nitin1 is offline  
December 14th, 2012, 04: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?
Hoempa is offline  
December 14th, 2012, 04: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 ?
nitin1 is offline  
December 14th, 2012, 05: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?
Hoempa is offline  
Reply

  My Math Forum > College Math Forum > Number Theory

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 01:26 PM
why is my function so stable at multiples of 22? mark212 Algebra 5 April 10th, 2012 09:06 PM
converting multiples Tylerman Applied Math 4 January 30th, 2012 01:15 PM
multiples of 2 pi Icevox Number Theory 8 March 25th, 2011 01:11 PM





Copyright © 2018 My Math Forum. All rights reserved.