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-2 of 2 results.

A332026 Savannah problem: number of new possibilities after n weeks.

Original entry on oeis.org

3, 4, 3, 5, 4, 4, 6, 5, 5, 5, 7, 6, 6, 6, 6, 8, 7, 7, 7, 7, 7, 9, 8, 8, 8, 8, 8, 8, 10, 9, 9, 9, 9, 9, 9, 9, 11, 10, 10, 10, 10, 10, 10, 10, 10, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12
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.
After step 4, there are either zero zebras or zero hungry lions (or both). Therefore, all possible populations can be positioned in a two-dimensional table, with the number of zebras on the positive part of one axis, the number of hungry lions on the negative part of the same axis and the total number of lions on the other axis (thus, a hungry lion is a lion with a deficit of one zebra). Tabulating the minimum number of weeks in which each population can occur, we get:
zebras
8 | 8 9 11 14 18
7 | 7 8 10 13 17
6 | 6 7 9 12 16
5 | 5 6 8 11 15
4 | 4 5 7 10 14
3 | 3 4 6 9 13
2 | 2 3 5 8 12
1 | 1 2 4 7 11
0 | 0 1 3 6 10
-1 | 1 2 5 9
-2 | 2 4 8
-3 | 4 7
-4 | 7
+------------------------------
0 1 2 3 4 lions
A(n) is the number of n's in a sufficiently large version of this table.
The row for Z=0 is equal to the sequence of triangular numbers (A000217).
The number of columns with new entries in week n is the integer inverse of triangular number (A002024) plus 1. The number of new entries in week n is usually the number of columns, except when n is a triangular number plus 1; then a new column is started and the number of new entries is the number of columns plus 1.

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, from Z we get: 2Z, ZF, and (ZH->) F; from F (which becomes H in the second step) we get: (ZH->) F, FH and 2H. From H (which becomes the empty set in the first step): Z, F and H. Overall, there are 4 new possible populations that were not possible after the first week: 2Z, ZF, FH, and 2H.
		

Crossrefs

See A332027 and A332028 for the total number of possibilities.

Programs

  • Python
    from math import isqrt
    from sympy.ntheory.primetest import is_square
    def A332026(n): return (isqrt(m:=n<<3)+1>>1)+is_square(m-7)+1 # Chai Wah Wu, Jun 07 2025

Formula

a(n) = A002024(n) + A010054(n) + 1.

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-2 of 2 results.