in reply to Re: Read file text and find fibonacci series

in thread Read file text and find fibonacci series

Hi, haukex.

while (/(?=($re))./g) { ... }

"Look for a fib anywhere ahead, then if found, consume its leftmost digit, then repeat" probably makes no sense, even for this assignment/homework. The `%fib` was built but not actually used. The "3 element" part of assignment (not addressed in your code) could be either consecutive, or just ascending fibs. But, the way `%fib` was constructed, it may be to help looking for a fib whose initial digits are a fib too, whose initial digits, ..., etc. While leftmost digit of any 2-digit fib is a fib, -- I wonder if any value of `%fib` could be an array with more than 3 elements? :)

P.S. Please, I'm not appealing to rewrite anything, don't waste your time, the task is too much unclear.

P.P.S. And, I suspect the "PERFECT SQUARE" in OP, in C, won't work for 6-digit numbers and `int` type, because of overflow?