0

I have a 3 frequencies 5,10,15 and i have the start year 1990.

I want to calculate the the recurrence of the events for the above frequencies

from the start year till the user defined year for ex till 2025

so the for the frequency 5 it will be 1995,2000,2005 etc toll 2025 .

The last frequency is called the replace frequency and after the 15 years the cycle is repeated

i can do 2 while loops and calculate the frequency recurrence but the time consumed in calculation is very long ..

Is there any mathematical shortcut (faster way) where i can generate the recurrence from the current year and get the exact array of the years for all the frequecies...

gaurus
  • 426
  • 1
  • 4
  • 16
  • 1
    show us some your code. did you try anything? – Mysterion Jan 27 '15 at 14:52
  • Are you looking for the Least Common Multiple? There are numerous examples on how to calculate it, for example http://www.sanfoundry.com/c-program-gcd-lcm-two-integers/ for the base algorithm, and http://stackoverflow.com/questions/147515/least-common-multiple-for-3-or-more-numbers to extend it to more than 2 numbers. – Klas Lindbäck Jan 28 '15 at 08:18
  • http://stackoverflow.com/questions/9084374/get-a-range-of-dates-given-an-interval-and-step – gaurus Feb 08 '15 at 17:14

0 Answers0