

A178715


a(n) = solution to the "Select All, Copy, Paste" problem: Given the ability to type a single letter, or to type individual "Select All", "Copy" or "Paste" command key strokes, what is the maximal number of letters of text that can be obtained with n key strokes?


36



1, 2, 3, 4, 5, 6, 9, 12, 16, 20, 27, 36, 48, 64, 81, 108, 144, 192, 256, 324, 432, 576, 768, 1024, 1296, 1728, 2304, 3072, 4096, 5184, 6912, 9216, 12288, 16384, 20736, 27648, 36864, 49152, 65536, 82944, 110592, 147456, 196608, 262144, 331776, 442368, 589824, 786432, 1048576, 1327104, 1769472, 2359296, 3145728, 4194304
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

It is assumed that we start with a single letter in the copy buffer.
Alternatively, a(n1) = maximal value of Product (k_i1) for any way of writing n = Sum k_i.
1. The description above assumes that the text is deselected after the Copy command is invoked.
2. This sequence is the solution to the equivalent problem formulated as {insert, "Select All+ Copy" macro (without deselection), Paste}.
3. This sequence is a "paradigmshift" sequence with procedure length p =1 (in the sense of A193455).
4. The optimal number of pastes per copy, as measured by the geometric growth rate (p+z root of z), is z = 4. [noninteger maximum between 3 and 4]
5. The function a(n) = maximum value of the product of the terms k_i, where Sum (k_i) = n+1i_max.
6. All solutions will be of the form a(n) = m^b * (m+1)^d.


LINKS

Joerg Arndt, Table of n, a(n) for n = 1..101
Jonathan T. Rowell, Solution Sequences for the Keyboard Problem and its Generalizations, Journal of Integer Sequences, Vol. 18 (2015), Article 15.10.7.
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,4).


FORMULA

a(n) = 4*a(n5) for n>=16.
a(n) =
a(5;10) = 5; 20 [C=1, 2 below, respectively]
a(n=1:14) = Q^(CR)*(Q+1)^R
where C = floor(n/5)+1, R = n+1 mod C,
and Q = floor(n+1/C)1
a(n>=15) = 3^(4R)*4^(C4+R)
where C = floor (n/5)+1, R = n mod 5.
G.f.: x*(1 +2*x +3*x^2 +4*x^3 +5*x^4 +2*x^5 +x^6 +3*x^10 +x^14) / (1 4*x^5).  Colin Barker, Nov 19 2016


EXAMPLE

For n = 7 the a(7) = 9 solution is to type the seven keystrokes: paste, paste, paste, selectall, copy, paste paste which yields nine text characters.
Here is a table showing the pattern for n = 1 to 35. The first column is n and the second column is the number of characters that can be obtained with n key strokes. The remainder of the line shows how to get the maximum, as follows. S = Select and C = Copy while a dot stands for Paste. The dots at the beginning of a line are equivalent to a single letter being typed, based on the assumption that at the start there is a single letter in the paste buffer.
01: 00001 .
02: 00002 ..
03: 00003 ...
04: 00004 ....
05: 00005 .....
06: 00006 ......
07: 00009 ...SC..
08: 00012 ....SC..
09: 00016 ....SC...
10: 00020 .....SC...
11: 00027 ...SC..SC..
12: 00036 ....SC..SC..
13: 00048 ....SC...SC..
14: 00064 ....SC...SC...
15: 00081 ...SC..SC..SC..
16: 00108 ....SC..SC..SC..
17: 00144 ....SC...SC..SC..
18: 00192 ....SC...SC...SC..
19: 00256 ....SC...SC...SC...
20: 00324 ....SC..SC..SC..SC..
21: 00432 ....SC...SC..SC..SC..
22: 00576 ....SC...SC...SC..SC..
23: 00768 ....SC...SC...SC...SC..
24: 01024 ....SC...SC...SC...SC...
25: 01296 ....SC...SC..SC..SC..SC..
26: 01728 ....SC...SC...SC..SC..SC..
27: 02304 ....SC...SC...SC...SC..SC..
28: 03072 ....SC...SC...SC...SC...SC..
29: 04096 ....SC...SC...SC...SC...SC...
30: 05184 ....SC...SC...SC..SC..SC..SC..
31: 06912 ....SC...SC...SC...SC..SC..SC..
32: 09216 ....SC...SC...SC...SC...SC..SC..
33: 12288 ....SC...SC...SC...SC...SC...SC..
34: 16384 ....SC...SC...SC...SC...SC...SC...
35: 20736 ....SC...SC...SC...SC..SC..SC..SC..
It appears that A000792 is the result if only one key stroke instead of two is required for the "Select All, Copy" operation. Here is the table. Here "C" means that all the previously typed characters are copied to the paste buffer.
01: 00001 .
02: 00002 ..
03: 00003 ...
04: 00004 ....
05: 00006 ...C.
06: 00009 ...C..
07: 00012 ....C..
08: 00018 ...C..C.
09: 00027 ...C..C..
10: 00036 ....C..C..
11: 00054 ...C..C..C.
12: 00081 ...C..C..C..
13: 00108 ....C..C..C..
14: 00162 ...C..C..C..C.
15: 00243 ...C..C..C..C..
16: 00324 ....C..C..C..C..
17: 00486 ...C..C..C..C..C.
18: 00729 ...C..C..C..C..C..
19: 00972 ....C..C..C..C..C..
20: 01458 ...C..C..C..C..C..C.
21: 02187 ...C..C..C..C..C..C..
22: 02916 ....C..C..C..C..C..C..
23: 04374 ...C..C..C..C..C..C..C.
24: 06561 ...C..C..C..C..C..C..C..
25: 08748 ....C..C..C..C..C..C..C..
26: 13122 ...C..C..C..C..C..C..C..C.
27: 19683 ...C..C..C..C..C..C..C..C..
28: 26244 ....C..C..C..C..C..C..C..C..
29: 39366 ...C..C..C..C..C..C..C..C..C.
30: 59049 ...C..C..C..C..C..C..C..C..C..
31: 78732 ....C..C..C..C..C..C..C..C..C..


MATHEMATICA

LinearRecurrence[{0, 0, 0, 0, 4}, {1, 2, 3, 4, 5, 6, 9, 12, 16, 20, 27, 36, 48, 64, 81}, 60] (* Harvey P. Dale, Apr 11 2017 *)


PROG

(PARI) Vec(x*(1 +2*x +3*x^2 +4*x^3 +5*x^4 +2*x^5 +x^6 +3*x^10 +x^14) / (1 4*x^5) + O(x^100)) \\ Colin Barker, Nov 19 2016
(Python)
def a(n):
c=int(n/5) + 1
if n<15:
if n==5: return 5
if n==10: return 20
r=(n + 1)%c
q=int((n + 1)/c)  1
return q**(c  r)*(q + 1)**r
else:
r=n%5
return 3**(4  r)*4**(c  4 + r)
print [a(n) for n in xrange(1, 102)] # Indranil Ghosh, Jun 27 2017


CROSSREFS

See A193286 for another version. Cf. A000792.
A000792, A178715, A193286, A193455, A193456, and A193457 are paradigm shift sequences with procedure lengths p=0,1,...,5, respectively.
Sequence in context: A133463 A187550 A057492 * A018123 A105859 A200445
Adjacent sequences: A178712 A178713 A178714 * A178716 A178717 A178718


KEYWORD

nonn,nice,easy


AUTHOR

Bill Blewett, Jan 11 2011


EXTENSIONS

Edited by N. J. A. Sloane, Jul 21 2011
Additional comment and formula from David Applegate, Jul 21 2011
Additional comments, formulas, and CrossRefs by Jonathan T. Rowell, Jul 30 2011
Added more terms, Joerg Arndt, Nov 15 2014


STATUS

approved



