login
a[n] = pi[n-pi[n-1]] + a[n - a[n-2]], where pi(x) = number of primes <= x.
1

%I #11 Sep 21 2014 14:23:57

%S 1,1,2,3,4,4,4,5,7,7,7,8,8,8,8,9,12,12,9,10,14,14,13,13,14,15,15,16,

%T 16,16,16,17,20,21,17,17,19,23,19,21,24,24,19,20,26,26,25,25,24,25,26,

%U 27,27,27,28,28,29,29,30,30,30,31,34,34,31,32,32,32,34,38,34,36,35,39,37

%N a[n] = pi[n-pi[n-1]] + a[n - a[n-2]], where pi(x) = number of primes <= x.

%C A reinversion-type sequence using pi as the inverse and the Hofstadter Q-numbers A005185 as the pattern sequence.

%H Reinhard Zumkeller, <a href="/A087875/b087875.txt">Table of n, a(n) for n = 1..10000</a>

%t hrid[n] =PrimePi[n-PrimePi[n-1]] + hrid[n - hrid[n-2]] digits=256 a=Table[hrid[n], {n, 1, digits}]

%o (Haskell)

%o import Data.List (genericIndex)

%o a087875 n = genericIndex a087875_list (n-1)

%o a087875_list = 1 : 1 : zipWith (+)

%o (map a087875 $ zipWith (-) [3..] a087875_list)

%o (map a000720 $ zipWith (-) [3..] $ tail a000720_list)

%o -- _Reinhard Zumkeller_, Sep 21 2014

%Y Cf. A005185.

%Y Cf. A000720.

%K nonn

%O 1,3

%A _Roger L. Bagula_, Oct 11 2003