Re: [algogeeks] Factorial vs Power

2012-09-28 Thread Rahul Singh

 did u get it submitted?

-- 
--
Thanks
Rahul Singh
B.tech CSE ,final Year
IIT Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] spoj problem EASYMATH

2012-09-28 Thread atul anand
@Wladimir : you have to use  formula given in below link

http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle

On Fri, Sep 28, 2012 at 12:26 AM, Wladimir Tavares wladimir...@gmail.comwrote:

 what happens when a = 3, d = 5
 a, a + d, d +2, a +3 d = 3,8,13,18?

 Wladimir Araujo Tavares
 *Federal University of CearĂ¡ http://lia.ufc.br/%7Ewladimir/
 Homepage http://lia.ufc.br/%7Ewladimir/ | 
 Maratonahttps://sites.google.com/site/quixadamaratona/|
 *





 On Thu, Sep 27, 2012 at 8:57 AM, atul anand atul.87fri...@gmail.comwrote:

 @ashish : here is the generalized equation
 http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle

 note : you need to take LCM of a,a+d,a+2d etc etcwhenever you are
 dividing to find count

 On Thu, Sep 27, 2012 at 2:55 AM, ashish pant asheesh...@gmail.comwrote:

 thanks for your reply.. actually i was thinking the same thing.. but I
 am facing problems in finding the unique multiples  of a+3d and a+4d as
 applying inclusion exclusion principle in this way is getting too difficult
 due to large no of factors to be added and subtracted.. is der any other
 approach or any way to simplify the process..

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] spoj problem EASYMATH

2012-09-28 Thread icy`
why not just brute force this?  one little array contains [a, (a+d),
(a+2d), (a+3d), (a+4d) ], which is then filtered so that none of those are
multiples of another.

Then set a count variable to m-n+1.  Check all numbers in range against
your little array, decrementing count and breaking out if a divisible num
is found.  In Ruby, screenshot so that syntax highlighting remains.
 (comments start with #  )

[image: Inline image 1]

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

image.png