in reply to Read file text and find fibonacci series
This appears to have been posted to Meditations, but I'm not sure if you meant it to be a question? Anyway, you're describing scanning a string looking for a pattern, which is exactly what regular expressions are good at. Ignoring the duplicate 1's, there are only 29 Fibonacci numbers with 1 to 6 digits, a regex can handle that just fine (and it would have no problem handling much more). See Building Regex Alternations Dynamically.
Update: You appear to have edited your node to remove its content, please see How do I change/delete my post? for why you shouldn't do that. Content restored, thanks Athanasius. Also made very minor fixups.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read file text and find fibonacci series
by vr (Curate) on Jan 03, 2018 at 00:01 UTC | |
by haukex (Archbishop) on Jan 03, 2018 at 09:00 UTC |