How to create numbers from other number (PHP/MATH)
Posted: Fri May 07, 2010 8:20 am
This is a challanging task for me, maybe there are smart people here that can solve it easily...
I need a php function that takes a number, and spits out other numbers that are related to this number. Let's call the function for createNumbers();
I will explain this math/php question with an example:
Let's say I have this in php:
Now the function will take the number 120 (but could be any number from 1 - 50000), and it will return a set of variables.
The stuff returned by createNumbers should be the following variables:
$num_0_1 --> which is a number, either 1 or 0
$num_1_2 --> another number, either 1 or 2
$num_1_3 --> another number, either 1, 2 or 3
$num_1_4 --> another number, either 1, 2, 3 or 4
...
$num_1_30 --> another number, either 1, 2, 3, 4, 5, 6 ... and so on up to 30
So, if I have this might return:
$num_0_1 = 1
$num_1_2 = 2
$num_1_3 = 3
$num_1_4 = 1
...
$num_1_30 = 23
And if I have or I will get other numbers. But the function must return the same numbers every time for each given number sent as an argument, in other words, I do not want any random functions here.
Don't ask why I need this function, but this is exactly what I need
I hope my explanation for this function is clear enough. I appreciate any help I can get.
I need a php function that takes a number, and spits out other numbers that are related to this number. Let's call the function for createNumbers();
I will explain this math/php question with an example:
Let's say I have this in php:
Code: Select all
createNumbers(120);The stuff returned by createNumbers should be the following variables:
$num_0_1 --> which is a number, either 1 or 0
$num_1_2 --> another number, either 1 or 2
$num_1_3 --> another number, either 1, 2 or 3
$num_1_4 --> another number, either 1, 2, 3 or 4
...
$num_1_30 --> another number, either 1, 2, 3, 4, 5, 6 ... and so on up to 30
So, if I have
Code: Select all
createNumbers(120)$num_0_1 = 1
$num_1_2 = 2
$num_1_3 = 3
$num_1_4 = 1
...
$num_1_30 = 23
And if I have
Code: Select all
createNumbers(43)Code: Select all
createNumbers(8320)Don't ask why I need this function, but this is exactly what I need
I hope my explanation for this function is clear enough. I appreciate any help I can get.