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.

Showing 1-10 of 14 results. Next

A194077 Natural interspersion of A060432; a rectangular array, by antidiagonals.

Original entry on oeis.org

1, 3, 2, 5, 4, 7, 8, 6, 10, 17, 11, 9, 13, 21, 34, 14, 12, 16, 25, 39, 60, 18, 15, 20, 29, 44, 66, 97, 22, 19, 24, 33, 49, 72, 104, 147, 26, 23, 28, 38, 54, 78, 111, 155, 212, 30, 27, 32, 43, 59, 84, 118, 163, 221, 294, 35, 31, 37, 48, 65, 90, 125, 171, 230, 304
Offset: 1

Views

Author

Clark Kimberling, Aug 14 2011

Keywords

Comments

See A194029 for definitions of natural fractal sequence and natural interspersion. Every positive integer occurs exactly once (and every pair of rows intersperse), so that as a sequence, A194077 is a permutation of the positive integers; its inverse is A194078.

Examples

			Northwest corner:
1...3...5...8...11...14
2...4...6...9...12...15
7...10..13..16..20...24
17..21..25..29..33..38
34..39..44..49..54..59
		

Crossrefs

Programs

  • Mathematica
    z = 70;
    c[k_] := Sum[Floor[1/2 + Sqrt[2 j]], {j, 0, k}];
    c = Table[c[k], {k, 1, z}]  (* A060432 *)
    f[n_] := If[MemberQ[c, n], 1, 1 + f[n - 1]]
    f = Table[f[n], {n, 1, 600}]   (* [A121997] *)
    r[n_] := Flatten[Position[f, n]]
    t[n_, k_] := r[n][[k]]
    TableForm[Table[t[n, k], {n, 1, 7}, {k, 1, 7}]]
    p = Flatten[Table[t[k, n - k + 1], {n, 1, 12}, {k, 1, n}]] (* A194077 *)
    q[n_] := Position[p, n]; Flatten[Table[q[n], {n, 1, 90}]]   (* A194078 *)

A206640 Primes in A060432.

Original entry on oeis.org

3, 5, 11, 61, 67, 73, 79
Offset: 1

Views

Author

Max Alekseyev, Feb 11 2012

Keywords

A002024 k appears k times; a(n) = floor(sqrt(2n) + 1/2).

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13
Offset: 1

Views

Author

Keywords

Comments

Integer inverse function of the triangular numbers A000217. The function trinv(n) = floor((1+sqrt(1+8n))/2), n >= 0, gives the values 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, ..., that is, the same sequence with offset 0. - N. J. A. Sloane, Jun 21 2009
Array T(k,n) = n+k-1 read by antidiagonals.
Eigensequence of the triangle = A001563. - Gary W. Adamson, Dec 29 2008
Can apparently also be defined via a(n+1)=b(n) for n >= 2 where b(0)=b(1)=1 and b(n) = b(n-b(n-2))+1. Tested to be correct for all n <= 150000. - José María Grau Ribas, Jun 10 2011
For any n >= 0, a(n+1) is the least integer m such that A000217(m)=m(m+1)/2 is larger than n. This is useful when enumerating representations of n as difference of triangular numbers; see also A234813. - M. F. Hasler, Apr 19 2014
Number of binary digits of A023758, i.e., a(n) = ceiling(log_2(A023758(n+2))). - Andres Cicuttin, Apr 29 2016
a(n) and A002260(n) give respectively the x(n) and y(n) coordinates of the sorted sequence of points in the integer lattice such that x(n) > 0, 0 < y(n) <= x(n), and min(x(n), y(n)) < max(x(n+1), y(n+1)) for n > 0. - Andres Cicuttin, Dec 25 2016
Partial sums (A060432) are given by S(n) = (-a(n)^3 + a(n)*(1+6n))/6. - Daniel Cieslinski, Oct 23 2017
As an array, T(k,n) is the number of digits columns used in carryless multiplication between a k-digit number and an n-digit number. - Stefano Spezia, Sep 24 2022
a(n) is the maximum number of possible solutions to an n-statement Knights and Knaves Puzzle, where each statement is of the form "x of us are knights" for some 1 <= x <= n, knights can only tell the truth and knaves can only lie. - Taisha Charles and Brittany Ohlinger, Jul 29 2023

Examples

			From _Clark Kimberling_, Sep 16 2008: (Start)
As a rectangular array, a northwest corner:
  1 2 3 4 5 6
  2 3 4 5 6 7
  3 4 5 6 7 8
  4 5 6 7 8 9
This is the weight array (cf. A144112) of A107985 (formatted as a rectangular array). (End)
G.f. = x + 2*x^2 + 2*x^3 + 3*x^4 + 3*x^5 + 3*x^6 + 4*x^7 + 4*x^9 + 4*x^9 + 4*x^10 + ...
		

References

  • Edward S. Barbeau, Murray S. Klamkin, and William O. J. Moser, Five Hundred Mathematical Challenges, Prob. 441, pp. 41, 194. MAA 1995.
  • R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 97.
  • K. Hardy and K. S. Williams, The Green Book of Mathematical Problems, p. 59, Solution to Prob. 14, Dover NY, 1985
  • R. Honsberger, Mathematical Morsels, pp. 133-134, MAA 1978.
  • J. F. Hurley, Litton's Problematical Recreations, pp. 152; 313-4 Prob. 22, VNR Co., NY, 1971.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 1, p. 43.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

a(n+1) = 1+A003056(n), A022846(n)=a(n^2), a(n+1)=A002260(n)+A025581(n).
A123578 is an essentially identical sequence.

Programs

  • Haskell
    a002024 n k = a002024_tabl !! (n-1) !! (k-1)
    a002024_row n = a002024_tabl !! (n-1)
    a002024_tabl = iterate (\xs@(x:_) -> map (+ 1) (x : xs)) [1]
    a002024_list = concat a002024_tabl
    a002024' = round . sqrt . (* 2) . fromIntegral
    -- Reinhard Zumkeller, Jul 05 2015, Feb 12 2012, Mar 18 2011
    
  • Haskell
    a002024_list = [1..] >>= \n -> replicate n n
    
  • Haskell
    a002024 = (!!) $ [1..] >>= \n -> replicate n n
    -- Sascha Mücke, May 10 2016
    
  • Magma
    [Floor(Sqrt(2*n) + 1/2): n in [1..80]]; // Vincenzo Librandi, Nov 19 2014
    
  • Maple
    A002024 := n-> ceil((sqrt(1+8*n)-1)/2); seq(A002024(n), n=1..100);
  • Mathematica
    a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* Branko Curgus, May 12 2009 *)
    Table[n, {n, 13}, {n}] // Flatten (* Robert G. Wilson v, May 11 2010 *)
    Table[PadRight[{},n,n],{n,15}]//Flatten (* Harvey P. Dale, Jan 13 2019 *)
  • PARI
    t1(n)=floor(1/2+sqrt(2*n)) /* A002024 = this sequence */
    
  • PARI
    t2(n)=n-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1) */
    
  • PARI
    t3(n)=binomial(floor(3/2+sqrt(2*n)),2)-n+1 /* A004736 */
    
  • PARI
    t4(n)=n-1-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1)-1 */
    
  • PARI
    A002024(n)=(sqrtint(n*8)+1)\2 \\ M. F. Hasler, Apr 19 2014
    
  • PARI
    a(n)=(sqrtint(8*n-7)+1)\2
    
  • PARI
    a(n)=my(k=1);while(binomial(k+1,2)+1<=n,k++);k \\ R. J. Cano, Mar 17 2014
    
  • Python
    from math import isqrt
    def A002024(n): return (isqrt(8*n)+1)//2 # Chai Wah Wu, Feb 02 2022
  • Sage
    [floor(sqrt(2*n) +1/2) for n in (1..80)] # G. C. Greubel, Dec 10 2018
    

Formula

a(n) = floor(1/2 + sqrt(2n)). Also a(n) = ceiling((sqrt(1+8n)-1)/2). [See the Liu link for a large collection of explicit formulas. - N. J. A. Sloane, Oct 30 2019]
a((k-1)*k/2 + i) = k for k > 0 and 0 < i <= k. - Reinhard Zumkeller, Aug 30 2001
a(n) = a(n - a(n-1)) + 1, with a(1)=1. - Ian M. Levitt (ilevitt(AT)duke.poly.edu), Aug 18 2002
a(n) = round(sqrt(2n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 01 2002
T(n,k) = A003602(A118413(n,k)); = T(n,k) = A001511(A118416(n,k)). - Reinhard Zumkeller, Apr 27 2006
G.f.: (x/(1-x))*Product_{k>0} (1-x^(2*k))/(1-x^(2*k-1)). - Vladeta Jovovic, Oct 06 2003
Equals A127899 * A004736. - Gary W. Adamson, Feb 09 2007
Sum_{i=1..n} Sum_{j=i..n+i-1} T(j,i) = A000578(n); Sum_{i=1..n} T(n,i) = A000290(n). - Reinhard Zumkeller, Jun 24 2007
a(n) + n = A014132(n). - Vincenzo Librandi, Jul 08 2010
a(n) = ceiling(-1/2 + sqrt(2n)). - Branko Curgus, May 12 2009
a(A169581(n)) = A038567(n). - Reinhard Zumkeller, Dec 02 2009
a(n) = round(sqrt(2*n)) = round(sqrt(2*n-1)); there exist a and b greater than zero such that 2*n = 2+(a+b)^2 -(a+3*b) and a(n)=(a+b-1). - Fabio Civolani (civox(AT)tiscali.it), Feb 23 2010
A005318(n+1) = 2*A005318(n) - A205744(n), A205744(n) = A005318(A083920(n)), A083920(n) = n - a(n). - N. J. A. Sloane, Feb 11 2012
Expansion of psi(x) * x / (1 - x) in powers of x where psi() is a Ramanujan theta function. - Michael Somos, Mar 19 2014
G.f.: (x/(1-x)) * Product_{n>=1} (1 + x^n) * (1 - x^(2*n)). - Paul D. Hanna, Feb 27 2016
a(n) = 1 + Sum_{i=1..n/2} ceiling(floor(2(n-1)/(i^2+i))/(2n)). - José de Jesús Camacho Medina, Jan 07 2017
a(n) = floor((sqrt(8*n-7)+1)/2). - Néstor Jofré, Apr 24 2017
a(n) = floor((A000196(8*n)+1)/2). - Pontus von Brömssen, Dec 10 2018
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - Amiram Eldar, Oct 01 2022
G.f. as array: (x^2*(1 - y)^2 + y^2 + x*y*(1 - 2*y))/((1 - x)^2*(1 - y)^2). - Stefano Spezia, Apr 22 2024

A006463 Convolve natural numbers with characteristic function of triangular numbers.

Original entry on oeis.org

0, 0, 1, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 40, 45, 50, 55, 60, 65, 70, 76, 82, 88, 94, 100, 106, 112, 119, 126, 133, 140, 147, 154, 161, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 249, 258, 267, 276, 285, 294, 303, 312, 321, 330, 340, 350, 360
Offset: 0

Views

Author

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
a(n) = length (i.e., number of elements minus 1) of longest chain in partition lattice Par(n). Par(n) is the set of partitions of n under "dominance order": partition P is <= partition Q iff the sum of the largest k parts of P is <= the corresponding sum for Q for all k.
If C_n(q, t) are the (q, t)-Catalan polynomials, then p_n(x) := C_n(x, x) is a polynomial in x such that a(n) is the degree of the lowest degree term. The sequence of polynomials p_n(x) = 1, 1, 2*x, x^2 + 4*x^3, 3*x^4 + 4*x^5 + 7*x^6 + ... while the coefficient of the lowest degree term is A074909(n). - Michael Somos, Jan 09 2019
If f is a strictly convex function computed on partitions of n (A000041), then a(n)+1 provides a lower bound on the number of distinct values of n taken by f across all partitions of n. - Noah A Rosenberg, Apr 18 2025

Examples

			a(6)=8; one longest chain consists of these 9 partitions: 6, 5+1, 4+2, 3+3, 3+2+1, 2+2+2, 2+2+1+1, 2+1+1+1+1, 1+1+1+1+1+1. Others are obtained by changing 3+3 to 4+1+1 or 2+2+2 to 3+1+1+1.
G.f. = x^2 + 2*x^3 + 4*x^4 + 6*x^5 + 8*x^6 + 11*x^7 + 14*x^8 + 17*x^9 + ...
		

References

  • N. A. Rosenberg, Mathematical Properties of Population-Genetic Statistics, Princeton University Press, 2025; page 113.
  • R. P. Stanley, Enumerative Combinatorics, Cambridge, Vol. 2, 1999; see Problem 7.2(f).

Crossrefs

0 together with the partial sums of A003056.

Programs

  • Haskell
    a006463 n = a006463_list !! n
    a006463_list = 0 : scanl1 (+) a003056_list
    -- Reinhard Zumkeller, Dec 17 2011
    
  • Mathematica
    a[n_] := (x = Quotient[ Sqrt[1+8*n]-1, 2]; x*(x^2-1+3*(n-x*(x+1)/2))/3); Table[a[n], {n, 0, 58}] (* Jean-François Alcover, Apr 11 2013, after Michael Somos *)
    t = {0}; Do[Do[AppendTo[t, t[[-1]]+n], {k, 0, n}], {n, 0, 11}]; t (* Jean-François Alcover, May 10 2016, after Vladimir Joseph Stephan Orlovsky *)
    Join[{0},Table[ListConvolve[Range[x],Table[If[OddQ[Sqrt[8n+1]],1,0],{n,x}]],{x,0,60}]//Flatten] (* Harvey P. Dale, Jan 14 2019 *)
  • PARI
    {a(n) = my(x); if( n<0, 0, x = (sqrtint(8*n + 1) - 1)\2; x * (x^2 - 1 + 3 * (n - x*(x+1)/2)) / 3)}; /* Michael Somos, Mar 06 2006 */
    
  • Python
    from math import isqrt
    def A006463(n): return (m:=isqrt((n<<3)+1)-1>>1)*(6*n-2-m*(m+3))//6 # Chai Wah Wu, Jun 07 2025

Formula

Let n=binomial(m+1, 2)+r, 0<=r<=m; then a(n) = (1/3)*m*(m^2+3*r-1).
G.f.: (psi(x) - 1) * x / (1 - x)^2 where psi() is a Ramanujan theta function. - Michael Somos, Mar 06 2006
a(n) = Sum_(k=0..n-1) A003056(k). - Daniele Parisse, Jul 10 2007
a(n+1) - 2*a(n) + a(n-1) = A010054(n) if n>0. - Michael Somos, May 07 2016

Extensions

Edited by Dean Hickerson, Nov 09 2002

A259280 a(n) is the minimal sum of a positive integer sequence of length n with no duplicate substrings of length greater than 1.

Original entry on oeis.org

1, 2, 4, 5, 7, 9, 11, 14, 16, 19, 21, 24, 27, 30, 33, 36, 40, 43, 47, 50, 54, 57, 61, 65, 69, 73, 77, 81, 85, 90, 94, 99, 103, 108, 112, 117, 121, 126, 131, 136, 141, 146, 151, 156, 161, 166, 172, 177, 183, 188, 194, 199, 205, 210, 216, 221, 227, 233, 239, 245
Offset: 1

Views

Author

Peter Kagey, Nov 30 2015

Keywords

Comments

The lexicographically earliest positive integer sequence with no duplicate substrings is [1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, ...].
Note: Trivial substring of length 1 are allowed to recur, i.e., duplicate terms are permitted.
Non-examples of positive integer sequences with no duplicate substrings are
[1, 1, 1] (the substring [1, 1] occurs twice) and [1, 2, 3, 1, 2] (the substring [1, 2] occurs twice).

Examples

			Lexicographically earliest examples:
a(1) = 1 via [1]
a(2) = 2 via [1, 1]
a(3) = 4 via [1, 1, 2]
a(4) = 5 via [1, 1, 2, 1]
a(5) = 7 via [1, 1, 2, 2, 1]
a(6) = 9 via [1, 1, 2, 1, 3, 1]
a(7) = 11 via [1, 1, 2, 2, 1, 3, 1]
a(8) = 14 via [1, 1, 2, 1, 3, 1, 4, 1]
a(9) = 16 via [1, 1, 2, 1, 3, 2, 2, 3, 1]
a(10) = 19 via [1, 1, 2, 1, 3, 2, 2, 3, 3, 1]
a(11) = 21 via [1, 1, 2, 1, 3, 2, 2, 3, 1, 4, 1]
a(12) = 24 via [1, 1, 2, 1, 3, 2, 2, 3, 3, 1, 4, 1]
a(13) = 27 via [1, 1, 2, 1, 3, 1, 4, 2, 2, 3, 2, 4, 1]
		

Programs

  • Ruby
    def a259280(n)
      lower_bound = 0.5 * (a060432(n - 1) + n + 1)
      lower_bound.ceil
    end

Formula

a(1) = 1, a(n) = ceiling((n + 1 + A060432(n - 1))/2) for n > 1.

A185869 (Odd,even)-polka dot array in the natural number array A000027; read by antidiagonals.

Original entry on oeis.org

2, 7, 9, 16, 18, 20, 29, 31, 33, 35, 46, 48, 50, 52, 54, 67, 69, 71, 73, 75, 77, 92, 94, 96, 98, 100, 102, 104, 121, 123, 125, 127, 129, 131, 133, 135, 154, 156, 158, 160, 162, 164, 166, 168, 170, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 379, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405
Offset: 1

Views

Author

Clark Kimberling, Feb 05 2011

Keywords

Comments

This is the second of four polka dot arrays; see A185868.
row 1: A130883;
row 2: A100037;
row 3: A100038;
row 4: A100039;
col 1: A014107;
col 2: A033537;
col 3: A100040;
col 4: A100041;
diag (2,18,...): A077591;
diag (7,31,...): A157914;
diag (16,48,...): A035008;
diag (29,69,...): A108928;
antidiagonal sums: A033431;
antidiagonal sums: 2*(1^3, 2^3, 3^3, 4^3,...) = 2*A000578.
A060432(n) + n is odd if and only if n is in this sequence. - Peter Kagey, Feb 03 2016

Examples

			Northwest corner:
  2....7....16...29...46
  9....18...31...48...69
  20...33...50...71...96
  35...52...73...98...127
		

Crossrefs

Cf. A000027 (as an array), A060432, A185868, A185870, A185871.

Programs

  • Haskell
    a185869 n = a185869_list !! (n - 1)
    a185869_list = scanl (+) 2 $ a' 1
      where  a' n = 2 * n + 3 : replicate n 2 ++ a' (n + 1)
    -- Peter Kagey, Sep 02 2016
    
  • Mathematica
    f[n_,k_]:=2n-1+(2n+2k-3)(n+k-1);
    TableForm[Table[f[n,k],{n,1,10},{k,1,15}]]
    Table[f[n-k+1,k],{n,14},{k,n,1,-1}]//Flatten
  • Python
    from math import isqrt, comb
    def A185869(n):
        a = (m:=isqrt(k:=n<<1))+(k>m*(m+1))
        x = n-comb(a,2)
        y = a-x+1
        return y*((y+(c:=x<<1)<<1)-5)+x*(c-3)+2 # Chai Wah Wu, Jun 18 2025

Formula

T(n,k) = 2n-1+(n+k-1)*(2n+2k-3), k>=1, n>=1.

A075349 a(1) = 1; first differences follow the pattern 1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,..., i.e., the next n differences are n.

Original entry on oeis.org

1, 2, 4, 6, 9, 12, 15, 19, 23, 27, 31, 36, 41, 46, 51, 56, 62, 68, 74, 80, 86, 92, 99, 106, 113, 120, 127, 134, 141, 149, 157, 165, 173, 181, 189, 197, 205, 214, 223, 232, 241, 250, 259, 268, 277, 286, 296, 306, 316, 326, 336, 346, 356, 366, 376, 386, 397, 408
Offset: 1

Views

Author

Amarnath Murthy, Sep 19 2002

Keywords

Programs

  • Mathematica
    Accumulate[Join[{1},Flatten[Table[Table[n,{n}],{n,12}]]]] (* Harvey P. Dale, Aug 26 2013 *)

Formula

a(n) = A060432(n-1) + 1. - David Wasserman, Jan 16 2005

Extensions

More terms from David Wasserman, Jan 16 2005

A035253 Second differences are 2,2,1,2,1,1,2,1,1,1,2,1,1,1,1,2,1,1,1,1,1,2,.. (A035214).

Original entry on oeis.org

4, 1, 0, 1, 3, 7, 12, 18, 26, 35, 45, 56, 69, 83, 98, 114, 131, 150, 170, 191, 213, 236, 260, 286, 313, 341, 370, 400, 431, 463, 497, 532, 568, 605, 643, 682, 722, 763, 806, 850, 895, 941, 988, 1036, 1085, 1135, 1186, 1239, 1293, 1348, 1404, 1461, 1519, 1578
Offset: 0

Views

Author

Robet Bronson (bob(AT)bronsons.com)

Keywords

Crossrefs

Different from A005228. Cf. A035254, A060432.

Programs

  • Python
    from math import isqrt
    def A035253(n): return (k:=(r:=isqrt(m:=n<<1))+int((m<<2)>(r<<2)*(r+1)+1)-1)*(k*(-k-3)+6*n-8)//6+(n*(n-5)>>1)+3 # Chai Wah Wu, Jun 07 2025

Formula

a(n) = A060432(n-1)+4+n*(n-7)/2. - Chai Wah Wu, Jun 07 2025

Extensions

More terms from Chai Wah Wu, Jun 07 2025

A332027 Savannah problem: number of distinct possible populations after n weeks, allowing populations after the empty set.

Original entry on oeis.org

3, 7, 10, 15, 19, 23, 29, 34, 39, 44, 51, 57, 63, 69, 75, 83, 90, 97, 104, 111, 118, 127, 135, 143, 151, 159, 167, 175, 185, 194, 203, 212, 221, 230, 239, 248, 259, 269, 279, 289, 299, 309, 319, 329, 339, 351, 362, 373, 384
Offset: 1

Views

Author

Jan Ritsema van Eck and Ali Sada, Feb 05 2020

Keywords

Comments

The Savannah math problem (Ali Sada, 26 Dec 2019 email to Seqfan list) is about a savannah ecosystem consisting of zebras, fed lions and hungry lions. Assume we start with an empty savannah. Each week, the following things happen in this order:
1. All hungry lions (if any) die.
2. All fed lions (if any) become hungry.
3. One animal enters the savannah. This can be a zebra, a fed lion or a hungry lion.
4. Let m = min (number of zebras, number of hungry lions); then m hungry lions eat m zebras and become m fed lions.
The Savannah math problem is to determine how many distinct populations are possible after n weeks. There are two versions. This sequence gives the number of possible populations if continuation from the empty set is allowed (see A332028 for the other version).
Since the three 1-animal populations (1 zebra, 1 fed lion and 1 hungry lion) can be reached directly from 1 hungry lion (via the empty set), they will be possible every week. Since all other possible populations are reached via one of these, any population that is possible in week n is also possible in week n+1. Therefore, the total number of possible populations in week n is the sum of all new populations in weeks 1 through n: A(n) is the partial sum of A332026.

Examples

			After one week, there are 3 possible populations, depending on which animal entered the savannah: one zebra (Z), one fed lion (F), one hungry lion (H). After two weeks, we have from Z: 2Z, ZF, and (ZH->) F; from F (which becomes H in the second step): (ZH->) F, FH and 2H; and from H (which becomes the empty set in the first step): Z, F and H. Overall, there are 7 distinct possible populations after the second week: 2Z, ZF, Z, FH, F, 2H and H.
		

Crossrefs

Programs

  • Python
    from math import isqrt
    def A332027(n): return (k:=(r:=isqrt(m:=n+1<<1))+int((m<<2)>(r<<2)*(r+1)+1)-1)*(6*n-2-k*(k+3))//6+(isqrt(n<<3)+1>>1)+(n<<1) # Chai Wah Wu, Jun 07 2025

Formula

a(n) = A060432(n) + A002024(n) + n.

A332028 Savannah problem: number of distinct possible populations after n weeks, not allowing new populations after the empty set.

Original entry on oeis.org

3, 5, 7, 11, 14, 17, 22, 26, 30, 34, 40, 45, 50, 55, 60, 67, 73, 79, 85, 91, 97, 105, 112, 119, 126, 133, 140, 147, 156, 164, 172, 180, 188, 196, 204, 212, 222, 231, 240, 249, 258, 267, 276, 285, 294, 305, 315, 325, 335, 345
Offset: 1

Views

Author

Jan Ritsema van Eck and Ali Sada, Feb 05 2020

Keywords

Comments

The Savannah math problem (Ali Sada, 26 Dec 2019 email to Seqfan list) is about a savannah ecosystem consisting of zebras, fed lions and hungry lions. Assume we start with an empty savannah. Each week, the following things happen in this order:
1. All hungry lions (if any) die.
2. All fed lions (if any) become hungry.
3. One animal enters the savannah. This can be a zebra, a fed lion or a hungry lion.
4. Let m = min(number of zebras, number of hungry lions); then m hungry lions eat m zebras and become m fed lions.
The Savannah math problem is to determine how many distinct populations are possible after n weeks. There are two versions. This sequence gives the number of possible populations if continuation from the empty set is not allowed (See A332027 for the other version).
Since all populations with one fed lion remain stationary as long as one zebra enters the savannah each week, and all populations with more than one lion follow directly or indirectly from those with one fed lion, we know for all population with one or more lions (except one hungry lion) that if they are possible in week n, they will also be possible in week n+1. The population with one hungry lion can only be reached via the empty set, so it is not possible after week 1. The same goes for the population of 1 zebra without lion. The population of k zebras without lion can only be reached from k-1 zebras without lion. So it is only possible in week k. This means that in week n, there are n populations that were possible in previous weeks but not any more: 1 hungry lion, and 1 through (n-1) zebras without lion. Therefore, the total number of possible populations in week n is equal to the number if continuation of the empty set is allowed (A332027), minus n (except in week 1, when it is 3).

Examples

			After one week, there are 3 possible populations, depending on which animal entered the savannah: one zebra (Z), one fed lion (F), one hungry lion (H). After two weeks, we have from Z: 2Z, ZF, and (ZH->) F; and from F (which becomes H in the second step): (ZH->) F, FH and 2H. Population which follow from H (which becomes the empty set in the first step), are not allowed. Overall, there are 5 distinct possible populations after the second week: 2Z, ZF, FH, F and 2H.
		

Crossrefs

Programs

  • Python
    from math import isqrt
    def A332028(n): return (k:=(r:=isqrt(m:=n+1<<1))+int((m<<2)>(r<<2)*(r+1)+1)-1)*(6*n-2-k*(k+3))//6+(isqrt(n<<3)+1>>1)+n if n>1 else 3 # Chai Wah Wu, Jun 07 2025

Formula

a(n) = A060432(n) + A002024(n), for n>1.
Showing 1-10 of 14 results. Next