Skip to content

Instantly share code, notes, and snippets.

@marcin119a
Created February 27, 2017 20:13
Show Gist options
  • Save marcin119a/802d9b25e832e10f5caad77a213a7fc8 to your computer and use it in GitHub Desktop.
Save marcin119a/802d9b25e832e10f5caad77a213a7fc8 to your computer and use it in GitHub Desktop.

Revisions

  1. marcin119a created this gist Feb 27, 2017.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #include <iostream>


    int pell(int n)
    {
    int n2 = 2, n1 = 2;

    for(int i=0;i<n;i++)
    {
    n1 = n2;
    n2 = n1 * 2 + n2;

    }
    return n2;


    }
    int main()
    {
    int n = 10;
    pell(10);

    std::cout << pell(10) << " " << std::endl;

    return 0;
    }