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.

A163801 a(n) = n - a(a(n-2)) with a(0)=0, a(1)=1.

This page as a plain text file.
%I A163801 #13 Jan 04 2025 22:28:06
%S A163801 0,1,2,2,2,3,4,5,6,6,6,7,8,8,8,9,10,11,12,12,12,13,14,15,16,16,16,17,
%T A163801 18,18,18,19,20,21,22,22,22,23,24,24,24,25,26,27,28,28,28,29,30,31,32,
%U A163801 32,32,33,34,34,34,35,36,37,38,38,38,39,40,41,42,42,42,43,44,44,44,45,46
%N A163801 a(n) = n - a(a(n-2)) with a(0)=0, a(1)=1.
%C A163801 A generalization of the Hofstadter G-sequence A005206 since it is part of the following family of sequences:
%C A163801 a(n)=n-a(a(n-k)) with the initial values a(0)=0,a(1)=a(2)=...=a(k-1)=1 and with k=1,2,3... (here k=2)
%C A163801 Every a(n) occurs either exactly one or exactly three times. Two blocks of three same elements are interrupted by either exactly one singular or exactly three consecutive natural numbers.
%C A163801 Since every natural number occurs in the sequence at least once the elements can be ordered in such a way that every n is connected to its a(n) in a tree structure so that:
%C A163801 ..a..
%C A163801 ..|..
%C A163801 .a(n)
%C A163801 This will give for the first 26 elements the following (ternary) tree:
%C A163801 ....1..............................
%C A163801 ....|..............................
%C A163801 ....2..............................
%C A163801 ./..|...\..........................
%C A163801 ....|......\.......................
%C A163801 ....|.........\....................
%C A163801 ....3...........4..................
%C A163801 ....|.............\................
%C A163801 ....5...............6..............
%C A163801 ....|.........../...|...\..........
%C A163801 ....7........8......9....10........
%C A163801 ....|....../.|.\....|.....\........
%C A163801 ....|...../..|..\...|......\.......
%C A163801 ....|..../....|..\..|.......\......
%C A163801 ...11...12....13.14.15......16.....
%C A163801 ....|../.|.\...|..|..|..../..|..\..
%C A163801 ...17.18.19.20.21.22.23.24..25..26.
%C A163801 Conjecture: Which features a certain structure (Comparable to A005206 or A135414). 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):
%C A163801 Diagram of D:
%C A163801 .....x......
%C A163801 .../.|.\....
%C A163801 ..D..C..x...
%C A163801 .........\..
%C A163801 ..........D.
%C A163801 Diagram of C:
%C A163801 ..x..
%C A163801 ..|..
%C A163801 ..C..
%H A163801 Alois P. Heinz, <a href="/A163801/b163801.txt">Table of n, a(n) for n = 0..10000</a>
%p A163801 a:= proc(n) option remember; `if`(n<2, n, n-a(a(n-2))) end:
%p A163801 seq(a(n), n=0..74);  # _Alois P. Heinz_, Dec 19 2024
%t A163801 A163801[n_] := A163801[n] = If[n < 2, n, n - A163801[A163801[n-2]]];
%t A163801 Array[A163801, 100, 0] (* _Paolo Xausa_, Jan 04 2025 *)
%Y A163801 Same recurrence relation as A135414.
%Y A163801 Cf. A379275.
%K A163801 easy,nonn
%O A163801 0,3
%A A163801 Daniel Platt (d.platt(AT)web.de), Aug 04 2009