#zebraw(
highlight-lines: (
(3, [to avoid negative numbers]),
(9, "50 => 12586269025"),
),
lang: true,
block-width: 100%,
numbering-separator: true,
wrap: false,
indentation: 4,
```rust
pub fn fibonacci_reccursive(n: i32) -> u64 {
if n < 0 {
panic!("{} is negative!", n);
}
match n {
0 => panic!("zero is not a right argument to fibonacci_reccursive()!"), 0 => panic!("zero is not a right argument to fibonacci_reccursive()!"),
1 | 2 => 1,
3 => 2,
_ => fibonacci_reccursive(n - 1) + fibonacci_reccursive(n - 2),
}
}
```,
)
1pub fn fibonacci_reccursive(n: i32) -> u64 {2 if n < 0 {3 panic!("{} is negative!", n);> to avoid negative numbers4 }5 match n {6 0 => panic!("zero is not a right argument to fibonacci_reccursive()!"), 0 => panic!("zero is not a right argument to fibonacci_reccursive()!"),7 1 | 2 => 1,8 3 => 2,9 _ => fibonacci_reccursive(n - 1) + fibonacci_reccursive(n - 2),> 50 => 1258626902510 }11}
#zebraw(
highlight-lines: (
(3, [to avoid negative numbers]),
(9, "50 => 12586269025"),
),
lang: true,
block-width: 100%,
wrap: true,
numbering-offset: 300,
indentation: 4,
```rust
pub fn fibonacci_reccursive(n: i32) -> u64 {
if n < 0 {
panic!("{} is negative!", n);
}
match n {
0 => panic!("zero is not a right argument to fibonacci_reccursive()!"),
1 | 2 => 1,
3 => 2,
_ => fibonacci_reccursive(n - 1) + fibonacci_reccursive(n - 2),
}
}
```,
)
301pub fn fibonacci_reccursive(n: i32) -> u64 {302 if n < 0 {303 panic!("{} is negative!", n);> to avoid negative numbers304 }305 match n {306 0 => panic!("zero is not a right argument to fibonacci_reccursive()!"),307 1 | 2 => 1,308 3 => 2,309 _ => fibonacci_reccursive(n - 1) + fibonacci_reccursive(n - 2),> 50 => 12586269025310 }311}
#zebraw(
highlight-lines: (
(3, [to avoid negative numbers]),
(9, "50 => 12586269025"),
),
// numbering: false,
lang: true,
block-width: 100%,
wrap: true,
numbering-separator: true,
indentation: 4,
header: [Test],
```typst
= Fibonacci Reccursive Function
This function calculates the Fibonacci number at the given index using a recursive approach.
```,
)
Test1= Fibonacci Reccursive Function23This function calculates the Fibonacci number at the given index using a recursive approach.> to avoid negative numbers
#zebraw(
lang: false,
highlight-lines: (
(1, rgb("#edb4b0").lighten(50%)),
(2, rgb("#a4c9a6").lighten(50%)),
),
```python
- device = "cuda"
+ device = accelerator.device
model.to(device)
```,
)
1- device = "cuda"2+ device = accelerator.device3 model.to(device)