cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A051135 a(n) = number of times n appears in the Hofstadter-Conway $10000 sequence A004001.

This page as a plain text file.
%I A051135 #52 Feb 16 2025 08:32:41
%S A051135 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,
%T A051135 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,
%U A051135 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
%N A051135 a(n) = number of times n appears in the Hofstadter-Conway $10000 sequence A004001.
%C A051135 If the initial 2 is changed to a 1, the resulting sequence (A265332) has the property that if all 1's are deleted, the remaining terms are the sequence incremented. - _Franklin T. Adams-Watters_, Oct 05 2006
%C A051135 a(A088359(n)) = 1 and a(A087686(n)) > 1; first differences of A188163. - _Reinhard Zumkeller_, Jun 03 2011
%C A051135 From _Robert G. Wilson v_, Jun 07 2011: (Start)
%C A051135 a(k)=1 for k = 3, 5, 6, 9, 10, 11, 13, 17, 18, 19, 20, 22, 23, 25, 28, ..., ; (A088359)
%C A051135 a(k)=2 for k = 1, 2, 7, 12, 14, 21, 24, 26, 29, 38, 42, 45, 47, 51, 53, ..., ; (1 followed by A266109)
%C A051135 a(k)=3 for k = 4, 15, 27, 30, 48, 54, 57, 61, 86, 96, 102, 105, 112, ..., ; (A267103)
%C A051135 a(k)=4 for k = 8, 31, 58, 62, 106, 116, 120, 125, 192, 212, 222, 226, ..., ;
%C A051135 a(k)=5 for k = 16, 63, 121, 126, 227, 242, 247, 253, 419, 454, 469, ..., ;
%C A051135 a(k)=6 for k = 32, 127, 248, 254, 475, 496, 502, 509, 894, 950, 971, ..., ;
%C A051135 a(k)=7 for k = 64, 255, 503, 510, 978, 1006, 1013, 1021, 1872, 1956, ..., ;
%C A051135 a(k)=8 for k = 128, 511, 1014, 1022, 1992, 2028, 2036, 2045, 3864, ..., ;
%C A051135 a(k)=9 for k = 256, 1023, 2037, 2046, 4029, 4074, 4083, 4093, 7893, ..., ;
%C A051135 a(k)=10 for k = 512, 2047, 4084, 4094, 8113, 8168, 8178, 8189, ..., . (End)
%C A051135 Compare above to array A265903. - _Antti Karttunen_, Jan 18 2016
%H A051135 Reinhard Zumkeller, <a href="/A051135/b051135.txt">Table of n, a(n) for n = 1..10000</a>
%H A051135 T. Kubo and R. Vakil, <a href="http://dx.doi.org/10.1016/0012-365X(94)00303-Z">On Conway's recursive sequence</a>, Discr. Math. 152 (1996), 225-252.
%H A051135 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Hofstadter-Conway10000-DollarSequence.html">Hofstadter-Conway $10,000 Sequence.</a>
%H A051135 Wikipedia, <a href="http://en.wikipedia.org/wiki/Hofstadter_sequence">Hofstadter sequence</a>
%H A051135 <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F A051135 From _Antti Karttunen_, Jan 18 2016: (Start)
%F A051135 a(n) = A188163(n+1) - A188163(n). [after _Reinhard Zumkeller_'s Jun 03 2011 comment above]
%F A051135 Other identities:
%F A051135 a(n) = 1 if and only if A093879(n-1) = 1. [See A188163 for a reason.]
%F A051135 (End)
%p A051135 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
%t A051135 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 *)
%o A051135 (Haskell)
%o A051135 import Data.List (group)
%o A051135 a051135 n = a051135_list !! (n-1)
%o A051135 a051135_list = map length $ group a004001_list
%o A051135 -- _Reinhard Zumkeller_, Jun 03 2011
%o A051135 (Scheme) (define (A051135 n) (- (A188163 (+ 1 n)) (A188163 n))) ;; _Antti Karttunen_, Jan 18 2016
%o A051135 (Magma)
%o A051135 nmax:=200;
%o A051135 h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n - Self(n-1)): n in [1..5*nmax]]; // h = A004001
%o A051135 A188163:= function(n)
%o A051135    for j in [1..3*nmax+1] do
%o A051135        if h[j] eq n then return j; end if;
%o A051135    end for;
%o A051135 end function;
%o A051135 A051135:= func< n | A188163(n+1) - A188163(n) >;
%o A051135 [A051135(n): n in [1..nmax]]; // _G. C. Greubel_, May 20 2024
%o A051135 (SageMath)
%o A051135 @CachedFunction
%o A051135 def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1)) # h=A004001
%o A051135 def A188163(n):
%o A051135     for j in range(1,2*n+1):
%o A051135         if h(j)==n: return j
%o A051135 def A051135(n): return A188163(n+1) - A188163(n)
%o A051135 [A051135(n) for n in range(1,201)] # _G. C. Greubel_, May 20 2024
%Y A051135 Cf. A004001, A087686, A093879, A188163, A266109, A267103 and array A265903.
%Y A051135 Cf. A088359 (positions of ones).
%Y A051135 Cf. A265332 (essentially the same sequence, but with a(1) = 1 instead of 2).
%K A051135 easy,nonn,nice
%O A051135 1,1
%A A051135 Robert Lozyniak (11(AT)onna.com)
%E A051135 More terms from _Jud McCranie_
%E A051135 Added links (in parentheses) to recently submitted related sequences - _Antti Karttunen_, Jan 18 2016