

A001196


Doublebitters: only even length runs in binary expansion.


28



0, 3, 12, 15, 48, 51, 60, 63, 192, 195, 204, 207, 240, 243, 252, 255, 768, 771, 780, 783, 816, 819, 828, 831, 960, 963, 972, 975, 1008, 1011, 1020, 1023, 3072, 3075, 3084, 3087, 3120, 3123, 3132, 3135, 3264, 3267, 3276, 3279, 3312
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

Numbers whose set of base 4 digits is {0,3}.  Ray Chandler, Aug 03 2004
n such that there exists a permutation p_1, ..., p_n of 1, ..., n such that i + p_i is a power of 4 for every i.  Ray Chandler, Aug 03 2004
The first 2^n terms of the sequence could be obtained using the Cantorlike process for the segment [0, 4^n1]. E.g., for n=1 we have [0, {1, 2}, 3] such that numbers outside of braces are the first 2 terms of the sequence; for n=2 we have [0, {1, 2}, 3, {4, 5, 6, 7, 8, 9, 10, 11}, 12, {13, 14}, 15] such that the numbers outside of braces are the first 4 terms of the sequence, etc.  Vladimir Shevelev, Dec 17 2012
From Emeric Deutsch, Jan 26 2018: (Start)
Also, the indices of the compositions having only even parts. For the definition of the index of a composition, see A298644. For example, 195 is in the sequence since its binary form is 11000011 and the composition [2,4,2] has only even parts. 132 is not in the sequence since its binary form is 10000100 and the composition [1,4,1,2] also has odd parts.
The command c(n) from the Maple program yields the composition having index n. (End)
After the kth step of generating the Koch snowflake curve, label the edges of the curve consecutively 0..3*4^k1 starting from a vertex of the originating triangle. a(0), a(1), ... a(2^k1) are the labels of the edges contained in one edge of the originating triangle. Add 4^k to each label to get the labels for the next edge of the triangle. Compare with A191108 in respect of the Sierpinski arrowhead curve.  Peter Munn, Aug 18 2019


LINKS

Sean A. Irvine, Table of n, a(n) for n = 0..10000
Ralf Stephan, Some divideandconquer sequences with (relatively) simple ordinary generating functions, 2004.
Ralf Stephan, Table of generating functions. [ps file]
Ralf Stefan, Table of generating functions. [pdf file]
Eric Weisstein's World of Mathematics, Koch Snowflake.
Wikipedia, Koch snowflake.
Index entries for sequences related to binary expansion of n


FORMULA

a(2n) = 4*a(n), a(2n+1) = 4*a(n) + 3.
a(n) = 3 * A000695(n).


MAPLE

Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 3350 do if type(product(1+c(n)[j], j = 1 .. nops(c(n))), odd) = true then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to W. Edwin Clark.  Emeric Deutsch, Jan 26 2018


MATHEMATICA

fQ[n_] := Union@ Mod[Length@# & /@ Split@ IntegerDigits[n, 2], 2] == {0}; Select[ Range@ 10000, fQ] (* Or *)
fQ[n_] := Union@ Join[IntegerDigits[n, 4], {0, 3}] == {0, 3}; Select[ Range@ 10000, fQ] (* Robert G. Wilson v, Dec 24 2012 *)


PROG

(Haskell)
a001196 n = if n == 0 then 0 else 4 * a001196 n' + 3 * b
where (n', b) = divMod n 2
 Reinhard Zumkeller, Feb 21 2014
(Python)
def inA001196(n):
while n != 0:
if n%4 == 1 or n%4 == 2:
return 0
n = n//4
return 1
n, a = 0, 0
while n < 20:
if inA001196(a):
print(n, a)
n = n+1
a = a+1 # A.H.M. Smeets, Aug 19 2019
(PARI) a(n) = 3*fromdigits(binary(n), 4); \\ Kevin Ryde, Nov 07 2020


CROSSREFS

3 times the Moserde Bruijn sequence A000695.
Two digits in other bases: A005823, A097252A097262, A191108.
Digit duplication in other bases: A338086, A338754.
Sequence in context: A331074 A290593 A005392 * A330941 A096854 A013191
Adjacent sequences: A001193 A001194 A001195 * A001197 A001198 A001199


KEYWORD

nonn,base,easy


AUTHOR

N. J. A. Sloane, based on an email from Bart la Bastide (bart(AT)xs4all.nl)


STATUS

approved



