{"id":12639,"date":"2021-10-01T11:00:58","date_gmt":"2021-10-01T05:30:58","guid":{"rendered":"https:\/\/python-programs.com\/?p=12639"},"modified":"2021-11-22T18:33:26","modified_gmt":"2021-11-22T13:03:26","slug":"python-program-to-generate-first-n-numbers-of-pell-series","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-generate-first-n-numbers-of-pell-series\/","title":{"rendered":"Python Program to Generate first N numbers of Pell Series"},"content":{"rendered":"

Given the number N, the task is to print the first n numbers of the pell series in Python.<\/p>\n

Pell Series:<\/strong><\/p>\n

The Pell Series is a series in which the next number equals the sum of twice the previous number and the number preceding the previous number.<\/p>\n

It begins with 1 and 2.<\/p>\n

Pell Numbers: 1,2,5,12,29,70,169,…<\/p>\n

Consider the following number sequence and try to match it to the definition of the Pell Series:<\/p>\n

1 + 2 x 2 = 5<\/p>\n

2 + 5* 2 = 12<\/p>\n

5 + 12 x 2 = 29<\/p>\n

12 + 29*2 = 70<\/p>\n

29 + 70*2 = 169<\/p>\n

and so on\u2026<\/p><\/blockquote>\n

Now that you have a clear idea of what the Pell Series are, let\u2019s move on to how we shall write the Python code to generate the same.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Given number = 12<\/pre>\n

Input:<\/strong><\/p>\n

The first 12 numbers of the pell series are :\r\n1 2 5 12 29 70 169 408 985 2378 5741 13860<\/pre>\n

Output:<\/strong><\/p>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given number = 21<\/pre>\n

Output:<\/strong><\/p>\n

The first 21 numbers of the pell series are :\r\n1 2 5 12 29 70 169 408 985 2378 5741 13860 33461 80782 195025 470832 1136689 2744210 6625109\r\n 15994428 38613965<\/pre>\n

Program to Generate first N numbers of Pell Series in Python<\/h2>\n

Below are the ways to generate the first N number of the pell series in Python.<\/p>\n