Skip to content
/ oeis Public

Code for generating interesting integer sequences from the OEIS using python3, C and C++

License

Notifications You must be signed in to change notification settings

PzanettiD/oeis

Repository files navigation

Integer sequences from the "Online Encyclopedia of Integer Sequences" (OEIS)

This repository is where I'll share the code that I made to generate some of the sequences in the OEIS.

Table of Contents

  • A000010 Euler's totient function phi(n): counts numbers <= n and prime to n.
    • Currently available in Python / C / C++. Demonstration with 0.1 delay:


  • A000032 Lucas numbers beginning at 2: L(n) = L(n-1) + L(n-2), L(0) = 2, L(1) = 1.
    • Currently available in Python / C / C++ (containing both a recursive and bottom-up approach).


  • A000043 Mersenne exponents: primes p such that 2^p - 1 is prime. Then 2^p - 1 is called a Mersenne prime.

  • A000045 Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
    • Currently available in Python / C / C++ (containing both a recursive and a bottom-up approach). Demonstration with 0.1 delay:


  • A000108 Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). Also called Segner numbers.
    • Currently available in Python / C / C++ (containing both a recursive and a bottom-up approach).

  • A000201 Lower Wythoff sequence: a(n) = floor(n x phi), where phi = (1+sqrt(5))/2.
    • Currently available in Python / C / C++.

  • A000217 Triangular numbers: a(n) = binomial(n+1,2) = n(n+1)/2 = 0 + 1 + 2 + ... + n.
    • Currently available in Python (containing both a arithmetic and a binomial method) / C / C++. Demonstration with 0.1 delay:


  • A005132 Recamán's sequence: a(0) = 0; for n > 0, a(n) = a(n-1) - n if positive and not already in the sequence, otherwise a(n) = a(n-1) + n.
    • Currently available in Python/ C / C++.

  • A005185 Hofstadter Q-sequence: a(1) = a(2) = 1; a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2.
    • Currently available in Python / C / C++ (containing both a recursive and bottom-up implementation).

  • A007318 Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!(n-k)!), 0 <= k <= n.
    • Currently available in Python / C (with some memory leakage to be fixed) / C++.

  • A035513 Wythoff array read by antidiagonals.
    • Currently available in Python / C++ (using Construction(1), from this)