Added solution for b using number sequence generation