A051135 a(n) = number of times n appears in the Hofstadter-Conway $10000 sequence A004001.
2, 2, 1, 3, 1, 1, 2, 4, 1, 1, 1, 2, 1, 2, 3, 5, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 6, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- T. Kubo and R. Vakil, On Conway's recursive sequence, Discr. Math. 152 (1996), 225-252.
- Eric Weisstein's World of Mathematics, Hofstadter-Conway $10,000 Sequence.
- Wikipedia, Hofstadter sequence
- Index entries for Hofstadter-type sequences
Crossrefs
Programs
-
Haskell
import Data.List (group) a051135 n = a051135_list !! (n-1) a051135_list = map length $ group a004001_list -- Reinhard Zumkeller, Jun 03 2011
-
Magma
nmax:=200; h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n - Self(n-1)): n in [1..5*nmax]]; // h = A004001 A188163:= function(n) for j in [1..3*nmax+1] do if h[j] eq n then return j; end if; end for; end function; A051135:= func< n | A188163(n+1) - A188163(n) >; [A051135(n): n in [1..nmax]]; // G. C. Greubel, May 20 2024
-
Maple
a[1]:=1: a[2]:=1: for n from 3 to 300 do a[n]:=a[a[n-1]]+a[n-a[n-1]] od: A:=[seq(a[n],n=1..300)]:for j from 1 to A[nops(A)-1] do c[j]:=0: for n from 1 to 300 do if A[n]=j then c[j]:=c[j]+1 else fi od: od: seq(c[j],j=1..A[nops(A)-1]); # Emeric Deutsch, Jun 06 2006
-
Mathematica
a[1] = 1; a[2] = 1; a[n_] := a[n] = a[a[n - 1]] + a[n - a[n - 1]]; t = Array[a, 250]; Take[ Transpose[ Tally[t]][[2]], 105] (* Robert G. Wilson v, Jun 07 2011 *)
-
SageMath
@CachedFunction def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1)) # h=A004001 def A188163(n): for j in range(1,2*n+1): if h(j)==n: return j def A051135(n): return A188163(n+1) - A188163(n) [A051135(n) for n in range(1,201)] # G. C. Greubel, May 20 2024
-
Scheme
(define (A051135 n) (- (A188163 (+ 1 n)) (A188163 n))) ;; Antti Karttunen, Jan 18 2016
Formula
Extensions
More terms from Jud McCranie
Added links (in parentheses) to recently submitted related sequences - Antti Karttunen, Jan 18 2016
Comments