A011784 Levine's sequence. First construct a triangle as follows. Row 1 is {1,1}; if row n is {r_1, ..., r_k} then row n+1 consists of {r_k 1's, r_{k-1} 2's, r_{k-2} 3's, etc.}; sequence consists of the final elements in each row.
1, 2, 2, 3, 4, 7, 14, 42, 213, 2837, 175450, 139759600, 6837625106787, 266437144916648607844, 508009471379488821444261986503540, 37745517525533091954736701257541238885239740313139682, 5347426383812697233786139576220450142250373277499130252554080838158299886992660750432
Offset: 1
Examples
{1,1}, {1,2}, {1,1,2}, {1,1,2,3}, {1,1,1,2,2,3,4}, {1,1,1,1,2,2,2,3,3,4,4,5,6,7}.
References
- Richard K. Guy, Unsolved Problems in Number Theory, Section E25.
- R. K. Guy, What's left?, in The Edge of the Universe: Celebrating Ten Years of Math Horizons, Deanna Haunsperger, Stephen Kennedy (editors), 2006, p. 81.
Links
- Johan Claes, Table of n, a(n) for n = 1..19
- Johnson Ihyeh Agbinya, Computer Board Games of Africa, (2004), see pages 113-114.
- R. K. Guy, What's left?, Math Horizons, Vol. 5, No. 4 (April 1998), pp. 5-7.
- Roland Miyamoto, Polynomial parametrisation of the canonical iterates to the solution of -gamma*g' = g^(-1), arXiv:2402.06618 [math.CO], 2024. See pp. 16-17.
- N. J. A. Sloane, My favorite integer sequences, in Sequences and their Applications (Proceedings of SETA '98).
- N. J. A. Sloane and Brady Haran, The Levine Sequence, Numberphile video (2021)
- N. J. A. Sloane, Colin Mallows, and Bjorn Poonen, Discussion of A011784. [Scans of pages 150-155 and 164 of my notebook "Lattices 77", from June-July 1997.]
Programs
-
Haskell
a011784 = last . a012257_row -- Reinhard Zumkeller, Aug 11 2014
-
Mathematica
(* This script is not suitable for computing more than 11 terms *) nmax = 11; ro = {{2, 1}}; a[1]=1; For[n=2, n <= nmax, n++, ro = Transpose[{Table[#[[2]], {#[[1]]}]& /@ Reverse[ro] // Flatten, Range[Total[ro[[All, 1]]]]}]; Print["a(", n, ") = ", a[n] = ro // Last // Last]]; Array[a, nmax] (* Jean-François Alcover, Feb 25 2016 *) NestList[Flatten@ MapIndexed[ConstantArray[First@ #2, #1] &, Reverse@ #] &, {1, 1}, 10][[All, -1]] (* Michael De Vlieger, Jul 12 2017, same limitations as above *)
-
R
# This works, as with the others, up to 11. lev2 <- function(x = 10, levprev= NULL){ x <- floor(x[1]) # levlen is the RLE values levterm <-rep(1,x) levlen[[1]] <- 2 for ( jl in 2:x) { rk <- length(levlen[[jl-1]]) for (jrk in 1: rk) { levlen[[jl]] <- c(levlen[[jl]], rep(jrk, times = levlen[[jl-1]][rk+1-jrk])) } levterm[jl] <- length(levlen[[jl]]) } return(invisible(list(levlen=levlen, levterm = levterm) ) ) } # Carl Witthoft, Apr 01 2021
Formula
a(n+2) = n-th row sum of A012257; e.g., 5th row of A012257 is {1, 1, 1, 2, 2, 3, 4} and the sum of elements is 1+1+1+2+2+3+4=14=a(7) - Benoit Cloitre, Aug 06 2003
a(n) = A012257(n,a(n+1)). - Reinhard Zumkeller, Aug 11 2014
Extensions
a(16) from Johan Claes, Jun 09 2004
a(17) (an 85-digit number) from Johan Claes, Jun 18 2004
Edited by N. J. A. Sloane, Mar 08 2006
a(18) (a 137-digit number) from Johan Claes, Aug 19 2008
Comments