Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #23 Jan 06 2025 20:03:40
%S 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 18,19,20,21,22,23,21,21,21,24,25,26,27,28,29,30,31,32,30,30,30,33,34,
%U 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 a(n) = n - a(a(a(n-3))) with a(0)=a(1)=a(2)=0.
%C 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 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 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 "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 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 .a(n)
%C ..|..
%C ..a.."
%C 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 Diagram of D:
%C ......x..........
%C ..../...\\\......
%C .../.....\\.\....
%C ../.......\.\.\..
%C .D...o.o...x.x.x.
%C ...........|.|.|.
%C ...........x.x.x.
%C ...........|.|.|.
%C ...........D.C.C.
%C (o will be filled by C)
%C Diagram of C:
%C \\...x.
%C \\\./..
%C .\\/...
%C ../\\..
%C ./.\\\.
%C C...\\\
%C (This means construct C, on its way from a(n) to n, crosses exactly k other paths, e.g., from 14 to 17.)
%C 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 Paolo Xausa, <a href="/A165565/b165565.txt">Table of n, a(n) for n = 0..10000</a>
%t A165565[n_] := A165565[n] = If[n < 3, 0, n - Nest[A165565, n-3, 3]];
%t Array[A165565, 100, 0] (* _Paolo Xausa_, Jan 05 2025 *)
%Y Mix from Hofstader H-Sequence A005374 and the Meta-Hofstadter G(-3)-Sequence A163874.
%K easy,nonn
%O 0,4
%A Daniel Platt (d.platt(AT)web.de), Sep 22 2009