View Single Post
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