Results 1 to 3 of 3

Math Help - Program formula given categories and num total?

  1. #1
    Newbie
    Joined
    Oct 2012
    From
    los angeles
    Posts
    2

    Program formula given categories and num total?

    I know this is unorthodox. Not even sure this is the correct forum.

    I have an algorithm, I believe, that i am in need of. I'll try to explain.

    The following number assignments will constantly change, so the formula needs to be able to adapt.

    max = 50

    I have three categories:

    Local, National, International

    Each will have a number assigned depending on a number of factors. So, for example. The *max* number above is the display on a page of the data in the three categories.
    Now, if I am only allowed 50 per page and each of those categories can have *n* amount and must be in the order supplied: Local shows all of its content, then national, then international. When one cat is exhausted the next category continues.
    Could have the remnants of one cat end, and one start up on the same page.

    So,

    max = 50

    Local = 149,
    National = 112,
    International = 40

    What would be the formula that which gives me the proper display request. I will have knowledge of the current page (page they request). We'll call that currPage.

    (Local - (max x (currPage - 1)) / max >= 1 --> request 50 Local if true;
    (Local - (max x (currPage - 1)) / max < 1 --> request the Modulus amount and then start into National


    I am just at a loss here on how to construct this sort of display. This is a programatic sort of thing.


    so, ultimately the display or logic would give me:

    page 1:
    Local = 50

    page 2:
    Local = 50

    page 3:
    Local = 49
    National = 1

    Page 4:
    National = 50

    Page 4:
    National = 13
    International = 37

    Page 5:
    International = 13
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Sep 2012
    From
    Australia
    Posts
    3,648
    Thanks
    601

    Re: Program formula given categories and num total?

    Hey Brightnail.

    What kind of environment are you running in? Excel? C++? VB?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Oct 2012
    From
    los angeles
    Posts
    2

    Re: Program formula given categories and num total?

    Javascript :-)

    thanks for replying.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: October 12th 2012, 04:28 PM
  2. Categories of Mathematics
    Posted in the Math Forum
    Replies: 5
    Last Post: August 23rd 2012, 08:16 PM
  3. Categories
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: July 30th 2010, 12:01 AM
  4. Total distance formula...
    Posted in the Calculus Forum
    Replies: 3
    Last Post: April 30th 2007, 06:31 PM

Search Tags


/mathhelpforum @mathhelpforum