cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A316434 a(n) = a(pi(n)) + a(n-pi(n)) with a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 22, 23, 23, 24, 25, 25, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 32, 33, 33, 34, 35, 35, 35, 36, 36, 37, 38, 39, 39, 39, 40, 41, 42, 42, 42, 43, 44, 44
Offset: 1

Views

Author

Altug Alkan, Jul 02 2018

Keywords

Comments

This sequence hits every positive integer.

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember: local p;
         p:= numtheory:-pi(n);
         procname(p) + procname(n-p)
    end proc:
    f(1):= 1: f(2):= 1:
    map(f, [$1..100]); # Robert Israel, Jul 03 2018
  • Mathematica
    a[1]=a[2]=1; a[n_] := a[n] = a[PrimePi[n]] + a[n - PrimePi[n]]; Array[a, 75] (* Giovanni Resta, Nov 02 2018 *)
  • PARI
    q=vector(75); for(n=1, 2, q[n] = 1); for(n=3, #q, q[n] = q[primepi(n)] + q[n-primepi(n)]); q
    (C++) See Links section.
    
  • Python
    from sympy import primepi
    def A316434(n):
        pp = primepi(n)
        return 1 if n == 1 or n == 2 else A316434(pp) + A316434(n-pp) # Chai Wah Wu, Nov 02 2018

Formula

a(n) = a(A000720(n)) + a(A062298(n)) with a(1) = a(2) = 1.
a(n+1) - a(n) = 0 or 1 for all n >= 1.