OFFSET
1,1
COMMENTS
1) Generate all 2^n different binary string of n bits.
2) For each string apply the following rules:
2.A) if the i-th bit of the string is 1:
the i-th bit of the result is 1 if and only if the (i-1)-th (mod n) AND the (i+1)-th (mod n) bit of the string is 1
2.B) if the i-th bit of the string is 0:
the i-th bit of the result is 1 if and only if the (i-1)-th (mod n) OR the (i+1)-th (mod n) bit of the string is 1
For example: If the original string is 10010, then the result of the algorithm is 01101.
The sequence counts the different possible values generated by the algorithm for all binary strings of length n.
EXAMPLE
For n=4 the 8 possible results generated by the algorithm are: [1001, 0000, 0011, 1111, 0110, 0101, 1010, 1100].
PROG
(PARI) padbin(i, n) = {b = binary(i); off = n - #b; vector(n, i, if (i> off, b[i - off], 0)); }
kprec(k, n) = if (kp = k-1, kp, n);
knext(k, n) = if ((kn = k+1) > n, 1, kn);
binv(v) = subst(Pol(v), x, 2);
transf(v, n) = {tv = vector(n); for (k=1, n, kp = kprec(k, n); kn = knext(k, n); if (v[k], if ((v[kp] == 1) && (v[kn] == 1), tv[k] = 1), if ((v[kp] == 1) || (v[kn] == 1), tv[k] = 1); ); ); tv; }
a(n) = {alls = []; for (i=0, 2^n-1, alls = Set(concat(alls, binv(transf(padbin(i, n), n)))); ); #alls; } \\ Michel Marcus, Apr 21 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Arthur Oviedo (aa.oviedo332(AT)uniandes.edu.co), Oct 28 2010
EXTENSIONS
a(12)-a(20) from Michel Marcus, Apr 21 2014
a(21)-a(30) from Giovanni Resta, Apr 22 2014
STATUS
approved