OFFSET
0,11
COMMENTS
Each of the even-indexed numbers in the sequence is the sum of two adjacent terms (taken from the formula for the Fibonacci sequence), while each of the odd-indexed numbers is the result of a single iteration of the function similar to the Collatz function; so I call a sequence like this a "Colla-nacci" sequence. When the sequence is graphed, one can see that it contains a fractal pattern of perfectly symmetric subsequences resembling cathedrals or a city-scape.
LINKS
Daniel Godzieba, Table of n, a(n) for n = 0..65535
MATHEMATICA
a[0] = 1; a[1] = 0; a[n_] := a[n] = If[EvenQ[n], a[n/2] + a[n/2 - 1], If[EvenQ[ a[(n - 1)/2]], a[(n - 1)/2]/2, (3*a[(n - 1)/2] - 1)/2]]; Array[a, 100, 0] (* Amiram Eldar, Aug 29 2019 *)
PROG
(Python)
import numpy as np
s = np.array([1, 0])
for i in range(1, 1000):
s = np.append(s, s[i] + s[i-1])
if s[i]%2==0:
s = np.append(s, s[i]//2)
else:
s = np.append(s, (3*s[i]-1)//2)
CROSSREFS
KEYWORD
AUTHOR
Daniel Godzieba, Aug 28 2019
STATUS
approved
