Is there any possibility to find a cycle length in very large portion of numbers (more than maximum value of bigest integer type in C/C++, let's say 2^20), without involving disk to perform it? The best situation would be to analyze them sequentially, as they arrive from standard input, but I'm pretty sure that is impossible and I need to store them in memory. But I hope I'm wrong. Numbers values are integers, they are coming from standard input.
Example: Input: ( 1 2 3 ... (2^20 triples of 1 2 3) ... 1 2 3) Desired result: 3
EDIT
let's think of cycle as a period (f(x) = f(x+t) for some t) - looking for value of t
let's assume that operating memory is too few to store all numbers (numbers can be more than 2^20) and might be gmp types.