Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Dec 05 2022 05:50:53
%S 1,2,4,7,9,12,16,19,23,26,28,33,37,40,46,49,53,58,62,67,71,74,76,85,
%T 89,92,98,103,107,110,120,123,125,132,140,143,147,154,158,163,169,174,
%U 180,185,189,192,194,211,211,212,222,227,227,234,240,241
%N a(1) = 2, a(n)=a(n-1)+2*Q(n)-n, n > 1 where Q = A005185.
%H Reinhard Zumkeller, <a href="/A064550/b064550.txt">Table of n, a(n) for n = 0..10000</a>
%H Roger L. Bagula, <a href="http://victorian.fortunecity.com/carmelita/435/hofstadterintegers.html">A Simulation of a Prime Type of Sequence: The Hofstadter Integers</a> [broken link]
%p A064550 := proc(n) option remember; if n=0 then 1 else A064550(n-1)+2*A005185(n-1)(n) - n; fi; end;
%t q[0] = q[1] = 1;
%t q[n_] := q[n - q[n - 1]] + q[n - q[n - 2]];
%t a[1] = 2;
%t a[n_] := a[n] = a[n - 1] + 2*(q[n] - n/2);
%t Table[ a[n], {n, 1, 70} ]
%o (ARIBAS): function a064550(maxarg: integer); var n,r,rm,q: integer; qar: array; begin qar := alloc(array,maxarg + 1); qar[0] := 1; for n := 1 to maxarg do if n < 2 then q := 1; else q := qar[n - qar[n - 1]] + qar[n - qar[n - 2]]; end; qar[n] := q; if n = 1 then r := 2; else r := rm + round(2*(q - n/2)); end; rm := r; write(r," "); end; end; a064550(65).
%o (Haskell)
%o a064550 n = a064550_list !! n
%o a064550_list = 1 : 2 : zipWith3 (\a q n -> a + 2 * q - n)
%o (tail a064550_list) (drop 2 a005185_list) [2..]
%o -- _Reinhard Zumkeller_, May 13 2012
%Y Cf. A064551, A064552, A005185.
%K nonn,nice,easy
%O 0,2
%A _Roger L. Bagula_, Oct 08 2001
%E More terms from _Vladeta Jovovic_, _Klaus Brockhaus_ and _Matthew Conroy_, Oct 09 2001