mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2004-09-19, 18:56   #1
Logic
 

100011110000102 Posts
Default Request for an equation.

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.
  Reply With Quote
Old 2004-09-19, 21:26   #2
marc
 
marc's Avatar
 
Jun 2004
UK

139 Posts
Default

f(n,x) = n + 2*n*floor(x/n) + x%n

where n is your n and x is the xth number and x=0 is the first.

eg. f(4,0) = 4, f(2,2) = 6
marc is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Diophantine Equation flouran Math 7 2009-12-12 18:48
An Equation to Solve davar55 Puzzles 3 2008-10-09 00:35
Possible solutions to an equation: Vijay Math 6 2005-04-14 05:19
Time to prp equation jasong Math 2 2005-03-11 03:30
Cuberoot Equation koal Puzzles 3 2003-07-03 11:58

All times are UTC. The time now is 12:42.

Sat Sep 26 12:42:13 UTC 2020 up 16 days, 9:53, 1 user, load averages: 1.57, 1.64, 1.63

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.