|
|
A125173
|
|
Minimum number of "k-splits" required to transform {n} to {1}.
|
|
3
|
|
|
0, 1, 1, 2, 2, 2, 2, 3, 2, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
A "k-split" is a transformation T(k) of a set of positive integers obtained by replacing the maximum element m of the set by k and m-2k, where 1<=k<=m/2, unless m = 2k in which case m is simply replaced by k.
Examples: T(4)({1,2,12}) = {1,2,4}, T(5)({1,2,12}) = {1,2,5}, T(6)({1,2,12}) = {1,2,6}.
Is this the same as the sequence of the minimum number of "d-swaps" required to reverse a word of length n, which was introduced by D. E. Knuth in Problem 11264 in the American Mathematical Monthly?
|
|
LINKS
|
Donald E. Knuth, Problem 11264, Amer. Math. Monthly, vol.114, no.1, p.77, (2007).
|
|
EXAMPLE
|
a(9) = 2, as shown by the sequence of 2 k-splits:
T(3)({9}) = {3}, followed by T(1)({3}) = {1}.
a(44) <= 5, as shown by the 5 k-splits:
T(15)({44}) = {14,15}, T(7)({14,15}) = {1,7,14}, T(7)({1,7,14}) = {1,7}, T(3)({1,7}) = {1,3} and finally T(1)({1,3}) = {1}.
Exhaustive calculation shows that no sequence of fewer k-splits will suffice for {44}, so a(44) = 5.
|
|
MAPLE
|
b:= proc(s) option remember; local m; m:= max(s[]);
`if`(m=1, 0, 1 +min(seq(b((s union {k, m-2*k})
minus {m, 0}), k=1..m/2)))
end:
a:= n-> b({n}):
|
|
MATHEMATICA
|
b[s_List] := b[s] = Module[{m = Max[s]}, If[m == 1, 0, 1 + Min[Table[b[s ~Union~ {k, m-2k} ~Complement~ {m, 0}], {k, 1, m/2}]]]];
a[n_] := b[{n}];
|
|
PROG
|
(Sage)
def split(k, S):
m = max( S )
S = S.difference( [m] )
p = m - 2 * k;
# if p < 0: return("invalid split")
S = S.union(Set([k]))
if p!=0: S = S.union(Set([p]))
return S
@CachedFunction
def min_split(S):
m = max( S )
if m <= 2: return int(m > 1)
ct = 0
mct = 999
k = 1
while k <= m/2:
ct = 1 + min_split( split(k, S) )
if ct < mct: mct = ct
k += 1
return mct
def a(n): return min_split( Set( [n] ) )
for n in [1..1100]: print(a(n))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Terms recomputed and terms a(58) and beyond added by Joerg Arndt, Apr 12 2014
|
|
STATUS
|
approved
|
|
|
|