What is the Equation for a Series of Numbers with a Repeating Pattern?

  • Context: Undergrad 
  • Thread starter Thread starter Logic
  • Start date Start date
  • Tags Tags
    Request
Click For Summary
SUMMARY

The discussion focuses on deriving an equation for generating a series of numbers with a repeating pattern based on a parameter n. The formula provided is m=(2j+1)*n+k, where j=0,1,2,... and k=0,1,...,n-1, allowing for the creation of sequences that exclude specific numbers. Examples include n=4 resulting in the series 4, 5, 6, 7, 12, 13, 14, 15, and n=2 resulting in 2, 3, 6, 7, 10, 11. Additionally, the use of the floor function is discussed to manage the repetition of integers in the sequence.

PREREQUISITES
  • Understanding of mathematical series and sequences
  • Familiarity with the floor function in mathematics
  • Basic knowledge of programming in C
  • Concept of modular arithmetic
NEXT STEPS
  • Research the properties of mathematical series and sequences
  • Learn about the floor function and its applications in programming
  • Explore modular arithmetic and its use in generating repeating patterns
  • Study C programming techniques for implementing mathematical functions
USEFUL FOR

Mathematicians, computer programmers, and anyone interested in generating numerical sequences with specific repeating patterns.

Logic
Messages
1
Reaction score
0
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.
 
Physics news on Phys.org
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.
 
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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 55 ·
2
Replies
55
Views
8K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K