%I #21 Oct 16 2024 21:49:55
%S 1,2,3,4,5,6,7,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15,8,1,16,9,2,17,10,3,
%T 18,11,4,19,12,5,20,13,6,21,14,7,22,15,8,23,1,16,9,24,2,17,10,25,3,18,
%U 11,26,4,19,12,27,5,20,13,28,6,21,14,29,7,22,15,30,8,23,1,16
%N Signature sequence of e^2 (arrange the numbers i+j*x (i,j >= 1) in increasing order; the sequence of i's is the signature of x).
%C If one deletes the first occurrence of 1, the first occurrence of 2, the first occurrence of 3, etc., then the sequence is unchanged. - _Brady J. Garvin_, Sep 11 2024
%C Any signature sequence A is closely related to the partial sums of the corresponding homogeneous Beatty sequence: Let Q(d) = d + the sum from g=0 to g=d-1 of floor(theta * g) and Qinv(i) = the maximum integer d such that Q(d) <= i. If there is some d for which Q(d) = i, then A_i = 1. Otherwise, A_i = A_{i - Qinv(i)} + 1. - _Brady J. Garvin_, Sep 13 2024
%D Clark Kimberling, "Fractal Sequences and Interspersions", Ars Combinatoria, vol. 45 p 157 1997.
%H T. D. Noe, <a href="/A023125/b023125.txt">Table of n, a(n) for n=1..1000</a>
%H Clark Kimberling, <a href="http://faculty.evansville.edu/ck6/integer/intersp.html">Interspersions</a>
%H <a href="/index/Si#signature_sequences">Index entries for sequences related to signature sequences</a>
%t Quiet[Block[{$ContextPath}, Needs["Combinatorica`"]], {General::compat}]
%t theta = E * E;
%t sums = {0};
%t cached = <||>;
%t A023125[i_] := Module[{term, path, base},
%t While[sums[[-1]] < i,
%t term = sums[[-1]] + Floor[theta * (Length[sums] - 1)] + 1;
%t AppendTo[sums, term];
%t cached[term] = 1
%t ];
%t path = {i};
%t While[Not[KeyExistsQ[cached, path[[-1]]]],
%t AppendTo[path, path[[-1]] - Combinatorica`BinarySearch[sums, path[[-1]]] + 3/2];
%t ];
%t base = cached[path[[-1]]];
%t MapIndexed[(cached[#1] = base + Length[path] - First[#2]) &, path];
%t cached[i]
%t ];
%t Print[Table[A023125[i], {i, 1, 100}]]; (* _Brady J. Garvin_, Sep 13 2024 *)
%o (Python)
%o from bisect import bisect
%o from sympy import floor, E
%o theta = E * E
%o sums = [0]
%o cached = {}
%o def A023125(i):
%o while sums[-1] < i:
%o term = sums[-1] + floor(theta * (len(sums) - 1)) + 1
%o sums.append(term)
%o cached[term] = 1
%o path = [i]
%o while path[-1] not in cached:
%o path.append(path[-1] - bisect(sums, path[-1]) + 1)
%o base = cached[path[-1]]
%o for offset, vertex in enumerate(reversed(path)):
%o cached[vertex] = base + offset
%o return cached[i]
%o print([A023125(i) for i in range(1, 1001)]) # _Brady J. Garvin_, Sep 13 2024
%Y Cf. A023126
%K nonn,easy,eigen,changed
%O 1,2
%A _Clark Kimberling_