Syntactic Confectionery Delight PerlMonks

### comment on

 Need Help??

Hi My goal is read only line from file , and find fibonacci series that has minimun 3 element.I want to control numbers from 1 to 6 digit. Fibonacci series starts 1,1,2,3,5,8,13,21,34,55,89, ...... .For example;File text document

49693463452312343388645

I division string 1 to 6 digit. Check 4 is fibonacci number , no , go ahaed 49 is fibonacci number , no, next 496 is fibonacci ,no, 4969 after 44693 ,after 496934 no.There isnt any fibonacci , go to next digit and do it again 9 , 96,969,9693,96934.

```use 5.010;
use strict;
use warnings;
open(FILE, "<:encoding(UTF-8)", "aa.txt") or die "Could not open file:
+ \$!";
my \$numbers;
while (<FILE>) {
\$numbers="\$_" ;
print "\$_";
}
chomp \$numbers;
print "\n\$numbers";
my \$len=length(\$numbers);
print "\n\$len\n";
my \$i;
my \$abc;
foreach my \$i (0..\$len){
foreach my \$j (1..6) {
print "\$j----->";
\$abc = substr(\$numbers,\$i,\$j);
print "\$abc\n";
}
print "***********************************\n";
}
close FILE;

I read to find fibonacci series with PERFECT SQUARE. I didn't use it. C code example

```// C++ program to check if x is a perfect square

#include <iostream>
#include <math.h>
using namespace std;

// A utility function that returns true if x is perfect square
bool isPerfectSquare(int x) {
int s = sqrt(x);
return (s*s == x);
}

// Returns true if n is a Fibinacci Number, else false
bool isFibonacci(int n) {
// n is Fibinacci if one of 5*n*n + 4 or 5*n*n - 4 or both
// is a perferct square
return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);
}

// A utility function to test above functions
int main() {
for (int i = 1; i <= 10; i++)
isFibonacci(i)? cout << i << " is a Fibonacci Number \n":
cout << i << " is a not Fibonacci Number \n" ;
+
return 0;
}

2017-12-29 Athanasius restored original content

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2019-10-14 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In 2019 the site I miss most is:

Results (36 votes). Check out past polls.

Notices?