OFFSET
0,2
COMMENTS
An analog of Fibonacci's rabbits. The behavior of the node is given by its age. A node of age 0 or 1 grows and one of age 2 or 3 produces a new node. - Christian G. Bower, Nov 13 2006
FORMULA
a(n) = a(n-3)+a(n-4)+3. - Ralf Stephan, Nov 12 2006
G.f.: (1+x+x^2)/(1-x-x^3+x^5). - Christian G. Bower, Nov 13 2006
EXAMPLE
step #0:
..1
step #1:
..2
step #2:
..3
step #3:
..3
./
1
step #4:
..3
./.\
2...1
step #5:
..3
./.\
3...2
step #6:
....3
.../.\
..3...3
./
1
step #7:
......3
..../...\
..3.......3
./.\...../
2...1...1
step #8:
......3
..../...\
..3.......3
./.\...../.\
3...2...2...1
PROG
(Ruby) class Node; def initialize; @n = 1; @c = [] end
def count; @c.inject(@n){|n, c| n + c.count} end
def grow; return @n += 1 if @n < 3; @c.each{|c| c.grow }
@c << Node.new if @c.size < 2; end; end; r = []; node = Node.new
30.times { r << node.count; node.grow }; p r
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Simon Strandgaard, Nov 12 2006
STATUS
approved