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.

A193286 a(n) is the maximal number of a's that can be produced in a blank document with n "keystrokes".

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 9, 12, 16, 20, 25, 30, 36, 48, 64, 80, 100, 125, 150, 192, 256, 320, 400, 500, 625, 768, 1024, 1280, 1600, 2000, 2500, 3125, 4096, 5120, 6400, 8000, 10000, 12500, 16384, 20480, 25600, 32000, 40000, 50000, 65536, 81920, 102400, 128000, 160000, 200000, 262144, 327680
Offset: 1

Views

Author

N. J. A. Sloane, Jul 20 2011

Keywords

Comments

A "keystroke" means one of the following:
a (i.e., hit the letter "a" on the keyboard)
Ctrl-a ("select all")
Ctrl-c (copy selected text to clipboard)
Ctrl-v (paste from clipboard to cursor location)
Alternatively, a(n-2) = maximal value of Product (k_i-2) for any way of writing n = Sum k_i
1. Note that the copy command does not deselect the text.
2. This sequence is a "paradigm-shift" sequence with procedure length p =2 (in the sense of A193455).
3. The optimal number of pastes per copy, as measured by the geometric growth rate (p+z root of z), is z = 4. [Non-integer maximum between 4 and 5.]
4. The function a(n) = maximum value of the product of the terms k_i, where Sum (k_i) = n + 2 - 2*i_max.
5. All solutions will be of the form a(n) = m^b * (m+1)^d.

Examples

			For n=25, C = floor(28/6) = 4, R = (27 mod 4) = 3, and Q = floor(27/4)-2 = 4; therefore, a(25) = 4^(4-3)*5^(3) = 4*5^3 = 500.
For n=9, we use the general solution, but with C=2 (rather than C=1). R=(11 mod 2)=1, Q=3, and a(9)=3^(2-1)*4^1 = 12.
		

Crossrefs

See A178715 for another version. Cf. A000792.
A000792, A178715, A193286, A193455, A193456, and A193457 are paradigm shift sequences of procedure lengths p=0,1,...,5, respectively.

Programs

  • Haskell
    -- See Theorem 5 in John Derbyshire link.
    a193286 n = p n [] where
       p 0 ks       = product ks
       p n []       = p (n-1) [1]
       p n (k:ks)
        | n < 0     = 0
        | otherwise = max (p (n-1) ((k+1):ks)) (p (n-3) (1:k:ks))
    -- Reinhard Zumkeller, Jul 22 2011, Jul 21 2011
    
  • Mathematica
    a[n_ /; 1 <= n <= 7] := n; a[8] = 9; a[n_ /; 9 <= n <= 27] := (c = Max[1, Floor[(n+3)/6]]; r = Mod[n+2, c]; q = Floor[(n+2)/c]-2;q^(c-r)*(q+1)^r);a[n_ /; n >= 28] := ({q, r} = QuotientRemainder[n+2, 6]; 4^(q-r)*5^r);Table[a[n], {n, 1, 60}] (* Jean-François Alcover, May 28 2015 *)
  • Python
    def a(n):
        if n<8: return n
        elif n==8: return 9
        elif n>8 and n<=27:
            c=max(1, ((n + 3)//6))
            r=(n + 2)%c
            q=((n + 2)//c) - 2
            return q**(c - r)*(q + 1)**r
        else:
            q=((n + 2)//6)
            r=(n + 2)%6
            return 4**(q - r)*5**r
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 27 2017, after Mathematica code

Formula

a(n) = 4*a(n-6) for n >= 34. [corrected by Georg Fischer, Jun 09 2022]
a(n) = a(8;9;15;21;27) = 9; 12; 48; 192; 768 - corresponding to [C=2;2;3;4;5 below].
a(n=9..27) = Q^(C-R) * (Q+1)^R where C = floor((n+3)/6) [minimum value 1], R = (n+2) mod C, and Q = floor((n+2)/C)-2.
a(n>=28) = 4^(C-R) * 5^R, where C = floor((n+2)/6), R = (n+2) mod 6.

Extensions

Additional comment and formula from David Applegate, Jul 21 2011
More terms from Reinhard Zumkeller, Jul 22 2011, Jul 21 2011
Additional comments, formulas, examples and CrossRefs from Jonathan T. Rowell, Jul 30 2011