I was trying to figure out a way to create Fibonacci sequences. I came across some topics on the net but these had long solutions that involved structs with iterators on impl …etc

Since I am not that familiar with rust’s features, I thought I first tried doing something I was more comfortable first and try and migrate to structs and impl…etc as I learn rust. This is when I came across these little peculiarity.

This first code creates a Fibonacci sequence up to the 94th element.

```
fn main() {
let mut my_vec = (0..50).collect::<Vec<u64>>();
let mut fib:Vec<u64> = vec![0;50];
for x in 0..fib.len() {
if x == 1 {
fib[x] = 1u64;
} else if x > 1 {
fib[x] = fib[x-1] + fib[x-2];
}
}
println!("{:?}", fib);
}
```

This next one creates only till the 47th

```
fn fibonacci_list(length: u64) {
let mut my_vec = (0..length).collect::<Vec<u64>>();
let mut fib = vec!(0;length as usize);
for x in 0..fib.len() {
if x == 1 {
fib[x] = 1;
} else if x > 1 {
fib[x] = fib[x-1] + fib[x-2];
}
}
println!("{:?}", fib);
}
fn main() {
fibonacci_list(47);
}
```

The error at the 48th shows as an attempt to add with overflow.

I don’t really understand where the overflow is.

Any help here would be appreciated.

Thank you in advance