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 #15 Mar 09 2024 11:54:02
%S 1,5,10,21,44,92,189,385,778,1565,3141,6294,12602,25219,50454,100926,
%T 201871,403763,807548,1615119,3230263,6460552,12921132,25842293,
%U 51684616,103369264,206738561,413477157,826954350,1653908737,3307817513,6615635066,13231270174
%N Index of starting position of n-th generation of terms in A063882.
%H Chai Wah Wu, <a href="/A132174/b132174.txt">Table of n, a(n) for n = 1..1002</a>
%H B. Balamohan, A. Kuznetsov and S. Tanny, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL10/Tanny/tanny3.html">On the behavior of a variant of Hofstadter's Q-sequence</a>, J. Integer Sequences, Vol. 10 (2007), #07.7.1.
%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (3, -2, 0, 0, 1, -3, 2).
%F From _Chai Wah Wu_, May 17 2017: (Start)
%F a(n) = 3*a(n-1) - 2*a(n-2) + a(n-5) - 3*a(n-6) + 2*a(n-7) for n > 8.
%F G.f.: x*(-5*x^7 + x^6 - x^5 - x^4 - x^3 + 3*x^2 - 2*x - 1)/((x - 1)^2*(2*x - 1)*(x^4 + x^3 + x^2 + x + 1)). (End)
%o (Python)
%o from __future__ import division
%o def A132174(n):
%o if n == 1:
%o return 1
%o if n == 2:
%o return 5
%o h, m = divmod(n - 3, 5)
%o return (382*2**(5*h + m)-10*2**m)//31- 7*h - m -(1 if m==3 else (-1 if m==4 else 2)) # _Chai Wah Wu_, May 17 2017
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Nov 07 2007
%E More terms from _Chai Wah Wu_, May 17 2017