File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,7 @@ use anyhow::Result;
22use clap:: Parser ;
33use malachite:: {
44 Integer ,
5- base:: num:: {
6- arithmetic:: traits:: Square ,
7- basic:: traits:: { One , Two , Zero } ,
8- } ,
5+ base:: num:: basic:: traits:: { One , Two , Zero } ,
96} ;
107use std:: { io:: { self , Write } , time:: Instant } ;
118
@@ -50,8 +47,6 @@ fn parse_input(s: &str) -> Option<i32> {
5047 }
5148}
5249
53- const FOUR : Integer = Integer :: const_from_unsigned ( 4 ) ;
54-
5550fn fib ( n : i32 ) -> Integer {
5651 if n == 0 {
5752 return Integer :: ZERO ;
@@ -68,7 +63,7 @@ fn fib(n: i32) -> Integer {
6863 let k = ( n - 1 ) / 2 ;
6964 let a = fib ( k) ;
7065 let b = fib ( k - 1 ) ;
71- return FOUR * a . square ( ) - b . square ( ) + Integer :: from ( -4 * ( k % 2 ) + 2 ) ;
66+ return ( Integer :: TWO * & a + & b ) * ( Integer :: TWO * & a - & b ) + Integer :: from ( -4 * ( k % 2 ) + 2 ) ;
7267}
7368
7469fn main ( ) -> Result < ( ) > {
You can’t perform that action at this time.
0 commit comments