- Home /

# Finding the relationship in a list to make an equation.

So I have an equation to form a list of 100 numbers

number[#]=(#*13)%100; right!! it looks like this.. 1)13 2)26 3)39 4)52 5)65 6)78 7)91 8)4 9)17 10)30 11)43 12)56 13)69 14)82 15)95 16)8

So I need another equation that would give me these numbers 1)77 2)54 3)31 4)8 5)85 6)62 7)39 8)16 9)93 10)70 11)47 12)24 13)1 14)78 15)55 16)32

How would I go about getting an equation for the second list of numbers?

Thanks!

**Answer** by SirCrazyNugget
·
Mar 16, 2014 at 03:23 AM

100 - #*23 % 100 Though are you sure it's more beneficial using a lookup table rather than performing the calculation when required?

hat was correct thank you.

I'm wondering if you could help me understand how to get the equation?

The variance of a each step is -23 (ignoring any modulo operations) so you know the function will contain

```
n * -23
```

If you start the array from 0) you'll see n at position 0 has the value 100,

```
so 100 - (n * 23)
or 100 + (n * -23)
or 100 + (-n * 23)
```

The modulo was easy to spot as it appears already in the other array but can be seen easily enough in the pattern too.

I'm making generated rooms with doors leading between them. Just was looking for a good way to tell what room to go back to.

Doing the calculation once per door on start won't effect performance it'll just up load time a little.

Oh I have another question so I want to add a third door in some of the rooms using this expression;

if(#*8%5==3) { //add door going to room expressed by this equation room= (#*21)%100 ; }

ATM I am using a search function to find a match

```
public static int matchingdoor(int rn)
{
for(int i=0; i<100; i++)
{
if(rn*8%5==3)
{
if(rn==((i*21)%100))
{
return(i);
}
}
}
return(-13);
}
```

Is there a way to find match's with an equation?

I want to enter the information into Exel so I can find ways to map out the rooms.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

A node in a childnode? 1 Answer

Master Server Current Games List 1 Answer

The name 'List' does not denote a valid type ('not found')? 1 Answer

Best way to list all active quests in a GUI 1 Answer

Custom list-item name 0 Answers