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 A165565 #27 Apr 09 2025 04:21:04 %S A165565 0,0,0,3,4,5,3,3,3,6,7,8,9,10,11,12,13,14,12,12,12,15,16,17,15,15,15, %T A165565 18,19,20,21,22,23,21,21,21,24,25,26,27,28,29,30,31,32,30,30,30,33,34, %U A165565 35,36,37,38,39,40,41,39,39,39,42,43,44,42,42,42,45,46,47,48,49,50,51,52 %N A165565 a(n) = n - a(a(a(n-3))) with a(0)=a(1)=a(2)=0. %C A165565 A generalization of the Hofstadter G-sequence A005206 since it is part of the following family of sequences (which would give for k=1, p=2 the original G-sequence): %C A165565 a(n) = n - (a^p)(n-k) where (a^p) denotes p recurrences of a on the given argument (e.g., this sequence would be denoted as n-(a^3)(n-3)) with a(0)=a(1)=...=a(k-1)=0 with k=1,2,3,..., p=1,2,3,... (here k=p=3). %C A165565 Shares nearly all properties with the a(n) = n - a(a(n-k)) family (quote from the page of the k=2-Sequence of this family, A163873, which applies to this family as well): %C A165565 "Some things can be said about this family of sequences: Every a(n) occurs either exactly once or exactly k+1 times (except for the initial values which occur k times). A block of k+1 occurrences of the same number n is interrupted after the first one by the following k-1 terms: n+1, n+2, ..., n+k-1 (e.g., see from [for this sequence: a(15) to a(20): 12,13,14,12,12,12]). %C A165565 Since every natural number occurs in each sequence of the family at least once and 0 <= a(n) <= n for all n [to be precise: From the (2*k)-th term on] the terms can be ordered in such a way that every n is connected to its a(n) in a tree structure so that: %C A165565 .a(n) %C A165565 ..|.. %C A165565 ..a.." %C A165565 This will give a (k+1)-ary tree which (Conjecture:) features a certain structure (similar to the G-sequence A005206 or other sequences of the above mentioned family: A163873, A163875 and A163874). If the (below) following two constructs (C and D) are added on top of their ends (either marked with C or D) one will (if starting with one instance of D) receive the above tree (x marks a node, o marks spaces for nodes that are not part of the construct but will be filled by the other construct, constructs apply only to this sequence, comments for the whole family!): %C A165565 Diagram of D: %C A165565 ......x.......... %C A165565 ..../...\\\...... %C A165565 .../.....\\.\.... %C A165565 ../.......\.\.\.. %C A165565 .D...o.o...x.x.x. %C A165565 ...........|.|.|. %C A165565 ...........x.x.x. %C A165565 ...........|.|.|. %C A165565 ...........D.C.C. %C A165565 (o will be filled by C) %C A165565 Diagram of C: %C A165565 \\...x. %C A165565 \\\./.. %C A165565 .\\/... %C A165565 ../\\.. %C A165565 ./.\\\. %C A165565 C...\\\ %C A165565 (This means construct C, on its way from a(n) to n, crosses exactly k other paths, e.g., from 14 to 17.) %C A165565 The first node of D always has k+1 child nodes where the first one consists of a new copy of D, the second one consists of (p-1) other nodes and then D. The remaining child nodes consist of (p-1) other nodes and then C. Between the first and the second leaf there is always space for k-1 nodes of construct C. Construct C, on its way from a(n) to n, always crosses exactly k paths (the right ones from construct D). %H A165565 Paolo Xausa, <a href="/A165565/b165565.txt">Table of n, a(n) for n = 0..10000</a> %t A165565 A165565[n_] := A165565[n] = If[n < 3, 0, n - Nest[A165565, n-3, 3]]; %t A165565 Array[A165565, 100, 0] (* _Paolo Xausa_, Jan 05 2025 *) %Y A165565 Mix from Hofstader H-Sequence A005374 and the Meta-Hofstadter G(-3)-Sequence A163874. %K A165565 easy,nonn %O A165565 0,4 %A A165565 Daniel Platt (d.platt(AT)web.de), Sep 22 2009