RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Programming/Maths Problem

0 Members and 1 Guest are viewing this topic.

*
Resident Cloud
Rep:
Level 91
Hi,

Was wondering if anyone could help me with a mathsy programmy problem. Its been driving me nuts:

Given an infinite number of colums, where odd numbered columns have x cells and even numbered columns have y cells. Each cell can hold one object, how do i figure out the column number of the nth item.

For further clarification and example;
x = 4
y = 3


At the moment i do some stupid while loop to work this out, Id love it if there was a one liner, or simple maths formula. Speed is essential here :(

Thanks for your help guys :)

*
Rep:
Level 67
Snape. Snape. Severus Snape.
You could do something like this http://ge.tt/8F1qJO6?c
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

*
Resident Cloud
Rep:
Level 91
How the hell did you figure that out :D?