OFFSET
0,3
COMMENTS
Note that Reed's version has errors (see A295558).
REFERENCES
R. Reed, The Lemming Simulation Problem, Mathematics in School, 3 (#6, Nov. 1974), front cover and pp. 5-6. [Describes the dual structure where new triangles are joined at vertices rather than edges.]
LINKS
Lars Blomberg, Table of n, a(n) for n = 0..10000
R. Reed, The Lemming Simulation Problem, Mathematics in School, 3 (#6, Nov. 1974), front cover and pp. 5-6. [Scanned photocopy of pages 5, 6 only, with annotations by R. K. Guy and N. J. A. Sloane]
N. J. A. Sloane, Illustration of first 11 generations of A161644 and A295560 (vertex-to-vertex version) [Include the 6 cells marked x to get A161644(11), exclude them to get A295560(11).]
N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
FORMULA
From Lars Blomberg, Dec 20 2017: (Start)
Empirically (correct to 3*10^6 terms):
Convert n+1 to binary and view it as 1a1b or 1a1b1,
where a is zero or more digits, let "ones" be the number of 1's in a,
and b is zero or more 0's, let "zeros" be the number of 0's.
Let "len" be the total number of binary digits.
Then r=A295559(n) is determined by ones, zeros, len, and the parity of n+1, as follows:
if (n==0,1,2) r=0,1,3
else if (n+1 is odd)
if (len==zeros+2) r=BVal(1, zeros-1) else if (zeros==0) r=BVal(ones+1, ones+1) else r=BVal(ones+2, ones+zeros)
else
if (len==zeros+1) r=AVal(zeros-2) else r=AVal(ones+zeros-1)
and
AVal(k)=6*(2^(k+1)-1)
BVal(k, kk)=3*2^k + sum(j=0,kk-1, 6 * 2^j) (End)
PROG
(PARI) \\ Empirically discovered algorithm.
AVal(k)=6*(2^(k+1)-1)
BVal(k, kk)={ local v; v = 3 * 2^k; for (j=0, kk-1, v += 6 * 2^j); v}
A295559(n)={ local (len, zeros, ones, r);
if(n==0, return(0));
if(n==1, return(1));
if(n==2, return(3));
n++; len=length(binary(n));
zeros=ones=0; i=bittest(n, 0); \\ Skip trailing 1
while(bittest(n, i)==0, zeros++; i++);
for(j=i+1, len-2, ones+=bittest(n, j));
if (bittest(n, 0)==1,
if (len==zeros+2, r=BVal(1, zeros-1), if (zeros==0, r=BVal(ones+1, ones+1), r=BVal(ones+2, ones+zeros))),
if (len==zeros+1, r=AVal(zeros-2), r=AVal(ones+zeros-1)));
r; }
vector(200, i, A295559(i-1))
\\ Lars Blomberg, Dec 20 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 27 2017
EXTENSIONS
Terms a(18) and beyond from Lars Blomberg, Dec 20 2017
STATUS
approved