login
A023125
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).
2
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, 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, 11, 26, 4, 19, 12, 27, 5, 20, 13, 28, 6, 21, 14, 29, 7, 22, 15, 30, 8, 23, 1, 16
OFFSET
1,2
COMMENTS
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
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
REFERENCES
Clark Kimberling, "Fractal Sequences and Interspersions", Ars Combinatoria, vol. 45 p 157 1997.
MATHEMATICA
Quiet[Block[{$ContextPath}, Needs["Combinatorica`"]], {General::compat}]
theta = E * E;
sums = {0};
cached = <||>;
A023125[i_] := Module[{term, path, base},
While[sums[[-1]] < i,
term = sums[[-1]] + Floor[theta * (Length[sums] - 1)] + 1;
AppendTo[sums, term];
cached[term] = 1
];
path = {i};
While[Not[KeyExistsQ[cached, path[[-1]]]],
AppendTo[path, path[[-1]] - Combinatorica`BinarySearch[sums, path[[-1]]] + 3/2];
];
base = cached[path[[-1]]];
MapIndexed[(cached[#1] = base + Length[path] - First[#2]) &, path];
cached[i]
];
Print[Table[A023125[i], {i, 1, 100}]]; (* Brady J. Garvin, Sep 13 2024 *)
PROG
(Python)
from bisect import bisect
from sympy import floor, E
theta = E * E
sums = [0]
cached = {}
def A023125(i):
while sums[-1] < i:
term = sums[-1] + floor(theta * (len(sums) - 1)) + 1
sums.append(term)
cached[term] = 1
path = [i]
while path[-1] not in cached:
path.append(path[-1] - bisect(sums, path[-1]) + 1)
base = cached[path[-1]]
for offset, vertex in enumerate(reversed(path)):
cached[vertex] = base + offset
return cached[i]
print([A023125(i) for i in range(1, 1001)]) # Brady J. Garvin, Sep 13 2024
CROSSREFS
Sequence in context: A033929 A025482 A375481 * A319657 A255594 A030108
KEYWORD
nonn,easy,eigen
STATUS
approved