%I #18 Mar 01 2023 15:26:13
%S 1,1,2,1,3,1,4,1,1,2,7,2,7,1,1,4,11,3,9,2,4,4,11,0,2,4,4,11,11,6,14,2,
%T 5,7,6,8,16,10,4,15,13,9,13,10,5,9,14,5,9,9,11,10,17,6,9,11,13,19,20,
%U 11,22,8,17,14,13,14,20,13,13,22,23,9,20,8,12,16,11,13,21,13,13,16,14,12
%N a(1) = 1. a(n+1) = number of earlier terms a(k) (1 <= k <= n) where a(k)+n is a prime.
%H T. D. Noe, <a href="/A114897/b114897.txt">Table of n, a(n) for n=1..2000</a>
%F a(n) = A123541(n-1) for n>3. - _T. D. Noe_, Apr 29 2007
%e If we add 10 to each of the first 10 terms of the sequence, we get
%e [11,11,12,11,13,11,14,11,11,12]. Of these only the six 11's and the 13 are primes. So a(11) = 7.
%t a[1] = 1; a[n_] := a[n] = (For[k = 1; cnt = 0, k < n, k++, If[PrimeQ[a[k] + n - 1], cnt++]]; cnt); Table[a[n], {n, 1, 84}] (* _Jean-François Alcover_, Sep 13 2013 *)
%o (PARI) {v=[1];for(n=2,250,w=vector(length(v)+1);s=0; for(i=1,length(v),w[i]=v[i];if(isprime(v[i]+n-1),s++));w[length(v)+1]=s;v=w);v} (Herrgesell)
%o (Haskell)
%o a114897 n = a114897_list !! (n-1)
%o a114897_list = 1 : f 1 [1] where
%o f x zs = z : f (x + 1) (z : zs) where
%o z = toInteger $ sum $ map (a010051 . (+ x)) zs
%o -- _Reinhard Zumkeller_, Jul 31 2012
%Y Cf. A010051, A108839, A123541.
%K nonn,nice
%O 1,3
%A _Leroy Quet_, Jan 05 2006
%E More terms from Lambert Herrgesell (zero815(AT)googlemail.com), Jan 16 2006
|