07-12-2018 10:08 AM
Hi,
Can anyone help me how to generate the sequence as below. Output is array of 3 elements and input is number of iteration.
No of Iteration | Index 0 | Index 1 | Index 2 |
5 | 0 | 0 | 5 |
10 | 0 | 5 | 10 |
15 | 5 | 10 | 15 |
20 | 5 | 10 | 20 |
25 | 5 | 15 | 25 |
30 | 10 | 20 | 30 |
n | x | y | z |
Thanks
Solved! Go to Solution.
07-12-2018 10:15 AM
07-12-2018 10:26 AM
Hi GerdW,
Thanks for the reply. As mentioned already number of iteration is the input for the program and the output is array of 3 elements
07-12-2018 10:31 AM
Do you have an algorithm that describes this, or are you just trying to get us to do your homework for you?
07-12-2018 10:34 AM
If i have an algorithm, I could have made it myself.
07-12-2018 10:55 AM - edited 07-12-2018 10:56 AM
looks like your algorithm is index1=(iterations / 15) *5, index2=(iterations / 7)*5, index3=iterations.
I'm guessing this is not just purely a mathematical exercise though.
You can achieve the modulus operations using the Remainder and Quotient function.
EDIT: I initiallly wrote out as modulus operations but you really want integer quotient.
07-12-2018 10:57 AM
Your example is insufficient to identify a pattern. For example:
07-12-2018 11:09 AM
@altenbach wrote:
Your example is insufficient to identify a pattern. For example:
- What should the output be if the input is not a multiple of five?
The input is always multiple of 5 only.
- What if the input is zero or negative?
Hence the type is unsigned, negative is taken care and zero is also not a valid input.
- Is there an upper limit for N?
No. But is is multiple of 5.
- The third element (Index 2) is trivial and just seem to repeat the input, but what about the first and second output element?
Thats the pattern what am looking for.
- "Index" is a somewhat reserved word with a special meaning. Why not use a different term.
- Can you give us some background information on where this should be used? What's the purpose?
Thanks