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.
%I A005375 M0458 #67 Jul 02 2025 16:01:54 %S A005375 0,1,1,2,3,4,5,5,6,6,7,8,8,9,10,11,11,12,13,14,15,15,16,17,18,19,19, %T A005375 20,20,21,22,23,24,24,25,25,26,27,27,28,29,30,31,31,32,32,33,34,34,35, %U A005375 36,37,37,38,39,40,41,41,42,42,43,44,44,45,46,47,47,48,49,50,51,51,52,53 %N A005375 a(0) = 0; a(n) = n - a(a(a(a(n-1)))) for n > 0. %C A005375 Rule for n-th term: a(n) = An, where An denotes the Lamé antecedent to (or right shift of) n, which is found by replacing each Lm(i) (Lm(n) = Lm(n-1) + Lm(n-4): A003269) in the Zeckendorffian expansion (obtained by repeatedly subtracting the largest Lamé number you can until nothing remains) by Lm(i-1) (A1=1). For example: 58 = 50 + 7 + 1, so a(58)= 36 + 5 + 1 = 42. - Diego Torres (torresvillarroel(AT)hotmail.com), Nov 24 2002 %C A005375 a(A194081(n)) = n and a(m) <> n for m < A194081(n). - _Reinhard Zumkeller_, Aug 17 2011 %C A005375 From _Pierre Letouzey_, Feb 20 2025: (Start) %C A005375 For all n >= 0, A005374(n) <= a(n) <= A005376(n) as proved in Letouzey-Li-Steiner link. %C A005375 Last equality A005374(n) = a(n) for n = 18; last equality a(n) = A005376(n) for n = 25. %C A005375 For all n >= 0, |a(n) - c*n| < 1.998 where c is the positive real root of x^4 + x - 1 = 0, c = 0.724491959000515611588372282... Proved in Letouzey link. (End) %D A005375 D. Hofstadter, "Goedel, Escher, Bach", p. 137. %D A005375 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A005375 Reinhard Zumkeller, <a href="/A005375/b005375.txt">Table of n, a(n) for n = 0..10000</a> %H A005375 Larry Ericksen and Peter G. Anderson, <a href="http://www.cs.rit.edu/~pga/k-zeck.pdf">Patterns in differences between rows in k-Zeckendorf arrays</a>, The Fibonacci Quarterly, Vol. 50, No. 1 (February 2012), pp. 11-18. %H A005375 Nick Hobson, <a href="/A005375/a005375.py.txt">Python program for this sequence</a> %H A005375 Pierre Letouzey, S. Li and W. Steiner, <a href="https://arxiv.org/abs/2410.00529">Pointwise order of generalized Hofstadter functions G,H and beyond</a>, arXiv:2410.00529 [cs.DM], 2024. %H A005375 Pierre Letouzey, <a href="https://arxiv.org/abs/2502.12615">Generalized Hofstadter functions G,H and beyond: numeration systems and discrepancy</a> arXiv:2502.12615 [cs.DM], 2025. %H A005375 <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a> %H A005375 <a href="/index/Go#GEB">Index entries for sequences from "Goedel, Escher, Bach"</a> %F A005375 a(n) = floor(c*n) + (-1) or 0 or 1 or 2, where c is the positive real root of x^4+x-1 = 0, c=0.724491959000515611588372282... (Conjectured with just 0 or 1 by _Benoit Cloitre_, Nov 05 2002; fixed and proved by Letouzey, see Letouzey link]. NB: see for instance a(120) = 88 for a difference of 2 and a(243) = 175 for a difference of -1). - _Pierre Letouzey_, Feb 20 2025 %F A005375 a(n + a(a(a(n)))) = n (proved in Letouzey-Li-Steiner link). - _Pierre Letouzey_, Feb 20 2025 %p A005375 H:=proc(n) option remember; if n=1 then 1 else n-H(H(H(H(n-1)))); fi; end proc; %t A005375 a[0]:= 0; a[n_]:= a[n]= a[n] = n - a[a[a[a[n-1]]]]; Table[a[n], {n, 0, 73}] (* _Alonso del Arte_, Aug 17 2011 *) %o A005375 (Haskell) %o A005375 a005375 n = a005375_list !! n %o A005375 a005375_list = 0 : 1 : zipWith (-) %o A005375 [2..] (map a005375 (map a005375 (map a005375 (tail a005375_list)))) %o A005375 -- _Reinhard Zumkeller_, Aug 17 2011 %o A005375 (SageMath) %o A005375 @CachedFunction # a = A005375 %o A005375 def a(n): return 0 if (n==0) else n - a(a(a(a(n-1)))) %o A005375 [a(n) for n in range(101)] # _G. C. Greubel_, Nov 14 2022 %K A005375 nonn,nice %O A005375 0,4 %A A005375 _N. J. A. Sloane_ %E A005375 More terms from _James Sellers_, Jul 12 2000