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.
%I A332027 #19 Jun 07 2025 16:42:48 %S A332027 3,7,10,15,19,23,29,34,39,44,51,57,63,69,75,83,90,97,104,111,118,127, %T A332027 135,143,151,159,167,175,185,194,203,212,221,230,239,248,259,269,279, %U A332027 289,299,309,319,329,339,351,362,373,384 %N A332027 Savannah problem: number of distinct possible populations after n weeks, allowing populations after the empty set. %C A332027 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: %C A332027 1. All hungry lions (if any) die. %C A332027 2. All fed lions (if any) become hungry. %C A332027 3. One animal enters the savannah. This can be a zebra, a fed lion or a hungry lion. %C A332027 4. Let m = min (number of zebras, number of hungry lions); then m hungry lions eat m zebras and become m fed lions. %C A332027 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). %C A332027 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. %F A332027 a(n) = A060432(n) + A002024(n) + n. %e A332027 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. %o A332027 (Python) %o A332027 from math import isqrt %o A332027 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 %Y A332027 Cf. A002024, A332026, A060432, A332028. %K A332027 nonn %O A332027 1,1 %A A332027 _Jan Ritsema van Eck_ and _Ali Sada_, Feb 05 2020