Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Request for an equation

  1. Sep 19, 2004 #1
    Let me start off by saying, I am terrible at math. I'm not even sure if I know how to explain this for you to understand, but here goes.

    I am trying to obtain an equation for series of numbers, with a repeating pattern.

    • The numbers must be greater or equal to n.
    • The first series of numbers, must compose of n whole numbers after n.
    • After the first, and each series of numbers, n numbers must be excluded, followed by n series of numbers, and so on..

    ex.

    n = 4

    would result in...

    4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23....

    n = 2

    2, 3, 6, 7, 10, 11...

    Thanks a lot in advance.
     
  2. jcsd
  3. Sep 19, 2004 #2

    mathman

    User Avatar
    Science Advisor
    Gold Member

    m=(2j+1)*n+k, where j=0,1,2,.... and k=0,1,...,n-1. k goes through a complete cycle for each j.
     
  4. Sep 19, 2004 #3

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Or if you're looking for an expression involving a single parameter, there are some tools you can use to build expressions.

    floor(x / 4) is a function that repeats one integer four times, then the next integer four times, and so on.

    x - 4*floor(x / 4) is a function that simply repeats the sequence 0, 1, 2, 3. (This computes the remainder of x divided by 4)


    floor(X), here, is the greatest integer function. So, floor(4) = 4, floor(6.8) = 6, and floor(-2.3) = -3.


    If you're writing this as a C program, and your parameter is always nonnegative then you can simply use (x / 4) for the first of these functions, and (x % 4) for the second.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Request for an equation
  1. Simultaneous Equations (Replies: 2)

  2. Help with equations (Replies: 2)

Loading...