Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Pip Taylor

You need to find the php configuration script on your system. Under Windows,
this is php.ini in you Windows directory.

Search through this configuration file for:

max_execution_time

and change the value to something other than 30 seconds, this will allow
your script to run for longer.

Experiment with the value until your script can complete. However, be warned
that making the time too long could make your system unresponsive!

Pip


- Original Message -
From: marke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 31, 2001 7:48 AM
Subject: [PHP] Compution of Fibonacci


 hi!
 i want to write a php script for Compution of Fibonacci(it is a integer
 equal the sum of 2 numbers befor it).but there's a error:Fatal error:
 Maximum execution time of 30 seconds exceeded in C:\phpscr\Fibonacci.php
 on line 6.i don't know why it happens.it looks like the loop can't be
 finished.

 my code:
 
 ?
 $i=0;
 $a=0;
 $b=0;
 $c=0;
 while ($i  17);
 {
 print table;
 print trtd$i/td;
 $a=$c+$b;
 print td$a/td/tr;
 $b=$a;
 $c=$b;
 $i++;
 }
 ?
 --
 Thanks.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Saquib Farooq

hi

well first of all you have to remove the colon -- ; sign from
the end of your while loop .. that will solve the problem for the time
out.
then there is problem with your code, this code will never get you
the fibonacci since the variable a,b and c never go abone 0, see. :).


On Tue, 31 Jul 2001, marke wrote:

 hi!
 i want to write a php script for Compution of Fibonacci(it is a integer
 equal the sum of 2 numbers befor it).but there's a error:Fatal error:
 Maximum execution time of 30 seconds exceeded in C:\phpscr\Fibonacci.php
 on line 6.i don't know why it happens.it looks like the loop can't be
 finished.
  
 my code:
 
 ?
 $i=0;
 $a=0;
 $b=0;
 $c=0;
 while ($i  17);
 {
 print table;
 print trtd$i/td;
 $a=$c+$b;
 print td$a/td/tr;
 $b=$a;
 $c=$b;
 $i++;
 }
 ?
 --
 Thanks.
 

-- 
  ,
 /'^ ^'\
   -((o)-(o))-
   --oOOO--(_)--OOOo---

   Saquib Farooq Malik
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]
   Sustainable Develpment
   Network Program (SDNP)
   Tel: 2270684

 .oooO
 (   )  Oooo.
   ---\ (---(   )--
   \_)   ) /
(_/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Muhv

Hi,

Remove the ; after while!
With ; while will loop only this line

Muhv

 my code:
 
 ?
 $i=0;
 $a=0;
 $b=0;
 $c=0;
 while ($i  17);
 {
 print table;
 print trtd$i/td;
 $a=$c+$b;
 print td$a/td/tr;
 $b=$a;
 $c=$b;
 $i++;
 }
 ?
 --
 Thanks.
 

-
Meeldetuletused kalendrist sms-lühisõnumina. Uuri järgi!
http://www.hot.ee



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Saquib Farooq

sorry i said to remove the colon sign from the end of the while loop, what
i meant was to remove the colon sign from the end of your while statement
:). plus it looks better to change the $c=1 to $b=1

On Tue, 31 Jul 2001, Saquib Farooq wrote:

 hi
 
   well first of all you have to remove the colon -- ; sign from
 the end of your while loop .. that will solve the problem for the time
 out.
   then there is problem with your code, this code will never get you
 the fibonacci since the variable a,b and c never go abone 0, see. :).
 
 
 On Tue, 31 Jul 2001, marke wrote:
 
  hi!
  i want to write a php script for Compution of Fibonacci(it is a integer
  equal the sum of 2 numbers befor it).but there's a error:Fatal error:
  Maximum execution time of 30 seconds exceeded in C:\phpscr\Fibonacci.php
  on line 6.i don't know why it happens.it looks like the loop can't be
  finished.
   
  my code:
  
  ?
  $i=0;
  $a=0;
  $b=0;
  $c=0;
  while ($i  17);
  {
  print table;
  print trtd$i/td;
  $a=$c+$b;
  print td$a/td/tr;
  $b=$a;
  $c=$b;
  $i++;
  }
  ?
  --
  Thanks.
  
 
 

-- 
  ,
 /'^ ^'\
   -((o)-(o))-
   --oOOO--(_)--OOOo---

   Saquib Farooq Malik
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]
   Sustainable Develpment
   Network Program (SDNP)
   Tel: 2270684

 .oooO
 (   )  Oooo.
   ---\ (---(   )--
   \_)   ) /
(_/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Stig Venaas

On Tue, Jul 31, 2001 at 11:59:07AM +0500, Saquib Farooq wrote:
 hi
 
   well first of all you have to remove the colon -- ; sign from
 the end of your while loop .. that will solve the problem for the time
 out.
   then there is problem with your code, this code will never get you
 the fibonacci since the variable a,b and c never go abone 0, see. :).

Just in case anyone is interested... If you want to find the n'th
Fibonacci number and not go through the entires sequence, you can
use the formula:

F(n) = ( P^n - (-P)^(-n) ) / sqrt(5) where P = (1 + sqrt(5))/2

and it's also possible to extend Fibonacci numbers to negative n.
Pretty fascinating (:

Also, if you have F(n) you can find F(n+1). Let x denote F(n).

F(n+1) = floor( (x + 1 + sqrt(5x^2)) / 2).

Stig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compution of Fibonacci

2001-07-31 Thread Saquib Farooq


On Tue, 31 Jul 2001, Stig Venaas wrote:

 On Tue, Jul 31, 2001 at 11:59:07AM +0500, Saquib Farooq wrote:
  hi
  
  well first of all you have to remove the colon -- ; sign from
  the end of your while loop .. that will solve the problem for the time
  out.
  then there is problem with your code, this code will never get you
  the fibonacci since the variable a,b and c never go abone 0, see. :).
 
 Just in case anyone is interested... If you want to find the n'th
 Fibonacci number and not go through the entires sequence, you can
 use the formula:
 
 F(n) = ( P^n - (-P)^(-n) ) / sqrt(5) where P = (1 + sqrt(5))/2
 
 and it's also possible to extend Fibonacci numbers to negative n.
 Pretty fascinating (:
 
 Also, if you have F(n) you can find F(n+1). Let x denote F(n).
 
 F(n+1) = floor( (x + 1 + sqrt(5x^2)) / 2).
 
 Stig
 
 
Oh please stop that ... you sound like my maths professor :). lol.

-- 
  ,
 /'^ ^'\
   -((o)-(o))-
   --oOOO--(_)--OOOo---

   Saquib Farooq Malik
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]
   Sustainable Develpment
   Network Program (SDNP)
   Tel: 2270684

 .oooO
 (   )  Oooo.
   ---\ (---(   )--
   \_)   ) /
(_/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]