Results 1 to 6 of 6

Math Help - Formula to match a pattern

  1. #1
    Newbie
    Joined
    Nov 2011
    Posts
    3

    Formula to match a pattern

    Hello,
    I'm working on a formula used currently in a game and I'm having issues. There are two such formulas in this game that I'm working on, and I've already figured out one - I'll post it as an example that may/may not help in figuring out the formula I'm working on now. Available operations are: addition, subtraction, multiplication, division, flooring, rounding.

    I think the best way to explain the pattern is to show what I have, and explain what needs to change. Feel free to ask questions if clarification is needed. Latex doesn't seem to like flooring/rounding from what I can tell, so I do apologize for not using it.

    y = round(floor(x / 5) * .1)

    In the above formula, x can be an integer 1-155. The formula works for it's intended purpose; y increases by 1 every 10th x starting at x=5. What I need is an extremely similar formula where everything is the same except y will not increase at: x=25, x=65, x=105, x=25+(40*n). As far as I know, there is no limitation on the number of decimal places pre-rounding/flooring, but after only integers should exist.

    I did come up with the original formula posted above, but finding one to match the modification has been elusive for me. Any assistance with this would be greatly appreciated!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Nov 2008
    Posts
    55

    Re: Formula to match a pattern

    I don't see how y increases by 1 every 10th x starting at x = 5.
    x = 5 gives round(1 * 0.1) = 0?
    x = 15 gives round(3 * 0.1) = 0?
    x = 25 gives round(5 * 0.1) = 1?
    How does your round operation work?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Nov 2011
    Posts
    3

    Re: Formula to match a pattern

    Ah, you are correct. I thought by stripping what I felt was unnecessary to get the exact number I wanted it would make things easier. I apologize for my lack of thought early this morning. The full formula for the first is this:

    round((floor(x/5)*.1)*y)

    where x is still an integer 1-155 and y is an integer 1-5, for my purposes you can assume y=5

    It's still stripped, but this time I'm sure the extra info you wont be needing
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Nov 2008
    Posts
    55

    Re: Formula to match a pattern

    Ok. So now:
    x = 5 => z = round(0.1*5) = 1
    x = 15 => z = round(0.3*5) = 2
    ...
    This does what you claimed (assuming y = 5, lower y will give different results).
    To get it not to increase at x = 25 + n*40, you could just write another of these that increases by one each 40th x starting at 25.
    floor(x/40 + 15/40) does just that.
    So round((floor(x/5)*.1)*5) - floor(x/40 + 15/40) should give you the desired results.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Nov 2011
    Posts
    3

    Re: Formula to match a pattern

    That does indeed work. Thanks a lot!
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Nov 2008
    Posts
    55

    Re: Formula to match a pattern

    You're welcome sir!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Issue: Probability formula for pattern sets
    Posted in the Statistics Forum
    Replies: 0
    Last Post: November 17th 2010, 12:59 PM
  2. What is the formula for this pattern?
    Posted in the Pre-Calculus Forum
    Replies: 1
    Last Post: March 22nd 2010, 10:51 AM
  3. Geometry Pattern Formula Help
    Posted in the Geometry Forum
    Replies: 2
    Last Post: September 4th 2009, 11:29 AM
  4. how can I match them?
    Posted in the Pre-Calculus Forum
    Replies: 3
    Last Post: February 1st 2009, 05:27 AM
  5. Geometry Pattern Formula
    Posted in the Geometry Forum
    Replies: 2
    Last Post: September 3rd 2008, 07:34 PM

Search Tags


/mathhelpforum @mathhelpforum