A001196
Double-bitters: only even length runs in binary expansion.
Original entry on oeis.org
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, 3315, 3324, 3327, 3840, 3843
Offset: 0
N. J. A. Sloane, based on an email from Bart la Bastide (bart(AT)xs4all.nl)
- Sean A. Irvine, Table of n, a(n) for n = 0..10000
- Robert Baillie and Thomas Schmelzer, Summing Kempner's Curious (Slowly-Convergent) Series, Mathematica Notebook kempnerSums.nb, Wolfram Library Archive, 2008.
- Ralf Stephan, Some divide-and-conquer sequences with (relatively) simple ordinary generating functions, 2004.
- Ralf Stephan, Table of generating functions. [ps file]
- Ralf Stephan, 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
3 times the Moser-de Bruijn sequence
A000695.
-
int a_next(int a_n) { int t = a_n << 1; return a_n ^ t ^ (t + 3); } /* Falk Hüffner, Jan 24 2022 */
-
a001196 n = if n == 0 then 0 else 4 * a001196 n' + 3 * b
where (n',b) = divMod n 2
-- Reinhard Zumkeller, Feb 21 2014
-
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[i-1] 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
# second Maple program:
a:= proc(n) option remember;
`if`(n<2, 3*n, 4*a(iquo(n, 2, 'r'))+3*r)
end:
seq(a(n), n=0..100); # Alois P. Heinz, Jan 24 2022
-
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 *)
-
a(n) = 3*fromdigits(binary(n),4); \\ Kevin Ryde, Nov 07 2020
-
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
-
from itertools import groupby
def ok2lb(n):
if n == 0: return True # by convention
return all(len(list(g))%2 == 0 for k, g in groupby(bin(n)[2:]))
print([i for i in range(3313) if ok2lb(i)]) # Michael S. Branicky, Jan 04 2021
-
def A001196(n): return 3*int(bin(n)[2:],4) # Chai Wah Wu, Aug 21 2023
A147991
Sequence S such that 1 is in S and if x is in S, then 3x-1 and 3x+1 are in S.
Original entry on oeis.org
1, 2, 4, 5, 7, 11, 13, 14, 16, 20, 22, 32, 34, 38, 40, 41, 43, 47, 49, 59, 61, 65, 67, 95, 97, 101, 103, 113, 115, 119, 121, 122, 124, 128, 130, 140, 142, 146, 148, 176, 178, 182, 184, 194, 196, 200, 202, 284, 286, 290, 292, 302, 304, 308, 310, 338, 340, 344, 346
Offset: 1
0th generation: 1;
1st generation: 2 4;
2nd generation: 5 7 11 13.
- Robert Israel, Table of n, a(n) for n = 1..10000
- Gevorg Hmayakyan, Trig identity for a(n)
- J. H. Loxton and A. J. van der Poorten, An Awful Problem About Integers in Base Four, Acta Arithmetica, volume 49, 1987, pages 193-203. In section 7, John Selfridge and Carole Lacampagne ask whether every k != 0 (mod 3) is the quotient of two terms of this sequence (cf. A351243 and A006288).
- Eric Weisstein's World of Mathematics, Cantor Set
- Eric Weisstein's World of Mathematics, Closure
See also the related sequences listed in
A191106.
One half of each position > 0 where
A307744 sets or equals a record.
-
import Data.Set (singleton, insert, deleteFindMin)
a147991 n = a147991_list !! (n-1)
a147991_list = f $ singleton 1 where
f s = m : (f $ insert (3*m - 1) $ insert (3*m + 1) s')
where (m, s') = deleteFindMin s
-- Reinhard Zumkeller, Feb 21 2012, Jan 23 2011
-
A147991:= proc(n) option remember; if n::even then 3*procname(n/2)-1 else 3*procname((n-1)/2)+1 fi end proc:
A147991(1):= 1:
[seq](A147991(i),i=1..1000); # Robert Israel, May 05 2014
-
nn=346; s={1}; While[s1=Select[Union[s, 3*s-1, 3*s+1], # <= nn &]; s != s1, s=s1]; s
a[ n_] := If[ n < -1 || n > 0, 3 a[Quotient[n, 2]] - (-1)^Mod[n, 2], 0]; (* Michael Somos, Dec 22 2018 *)
-
{a(n) = if( n<-1 || n>0, 3*a(n\2) - (-1)^(n%2), 0)}; /* Michael Somos, Dec 22 2018 */
-
a(n) = fromdigits(apply(b->if(b,1,-1),binary(n)), 3); \\ Kevin Ryde, Feb 06 2022
A191106
Increasing sequence generated by these rules: a(1)=1, and if x is in a then 3x-2 and 3x are in a.
Original entry on oeis.org
1, 3, 7, 9, 19, 21, 25, 27, 55, 57, 61, 63, 73, 75, 79, 81, 163, 165, 169, 171, 181, 183, 187, 189, 217, 219, 223, 225, 235, 237, 241, 243, 487, 489, 493, 495, 505, 507, 511, 513, 541, 543, 547, 549, 559, 561, 565, 567, 649, 651, 655, 657, 667, 669, 673, 675, 703, 705, 709, 711, 721, 723, 727, 729, 1459, 1461, 1465, 1467, 1477
Offset: 1
1 -> 3 -> 7,9 -> 19,21,25,27 -> ...
Similar formula as
A003278, A_(n+1)=(A_n,A_n+2*3^n).
-
h = 3; i = -2; j = 3; k = 0; f = 1; g = 9;
a = Union[Flatten[NestList[{h # + i, j # + k} &, f, g]]] (* A191106; regarding g, see note at A190803 *)
b = (a + 2)/3; c = a/3; r = Range[1, 900];
d = Intersection[b, r](* illustrates closure property *)
e = Intersection[c, r](* illustrates closure property *)
2 FromDigits[#, 3]&/@Tuples[{0, 1}, 7] + 1 (* Vincenzo Librandi, Jul 10 2019 *)
A307672
The right half of a bi-infinite word invariant under the balanced morphism, {0->501, 1->210, 2->123, 3->432, 4->345, 5->054}, starting from axiom a(0)=0.
Original entry on oeis.org
0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 5, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 5, 0, 1, 0, 5, 4, 5, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 5, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 5, 0
Offset: 0
The full ternary tree starts:
0
501
054501210
- Peter Munn, Table of n, a(n) for n = 0..5000
- R. W. Gosper and J. Ziegler-Hunts, Strange Series for Sierpinski’s Gasket, G4G10 Exchange Book, Vol. 2 (2012), 59-60.
- Sean A. Irvine, Java program (github).
- Bradley Klee, Sierpiński Arrowhead, Right Half.
- Bradley Klee, Sierpiński Arrowhead, Left and Right.
- Peter Munn, Mapped curves aligned with Sierpiński Gasket.
Cf.
A156595 (draws the Sierpinski gasket).
-
Arrowhead = {0->{5, 0, 1}, 1->{2, 1, 0}, 2->{1, 2, 3}, 3->{4, 3, 2}, 4->{3, 4, 5}, 5->{0, 5, 4}};
aR[n_]:=Nest[Part[Flatten[#/.Arrowhead], 2;;-1]&,{0},n];aR[7]
(* Second program: *)
S = SubstitutionSystem[{0 -> {5, 0, 1}, 1 -> {2, 1, 0}, 2 -> {1, 2, 3}, 3 -> {4, 3, 2}, 4 -> {3, 4, 5}, 5 -> {0, 5, 4}}, {0}, 5][[-1]]; S[[Ceiling[ Length[S]/2];;]] (* Jean-François Alcover, May 08 2019 *)
A306556
Integers that appear as (unreduced) numerators of segment endpoints when a ternary Cantor set is created.
Original entry on oeis.org
0, 1, 2, 3, 6, 7, 8, 9, 18, 19, 20, 21, 24, 25, 26, 27, 54, 55, 56, 57, 60, 61, 62, 63, 72, 73, 74, 75, 78, 79, 80, 81, 162, 163, 164, 165, 168, 169, 170, 171, 180, 181, 182, 183, 186, 187, 188, 189, 216, 217, 218, 219, 222, 223, 224, 225, 234, 235, 236, 237, 240, 241, 242, 243
Offset: 1
On 1st step we have [0,1/3] U [2/3,3/3] so we get a(1)=0, a(2)=1, a(3)=2, a(4)=3.
On 2nd step we have [0,1/9] U [2/9,3/9] U [6/9,7/9] U [8/9,9/9] so we get in addition a(5)=6, a(6)=7, a(7)=8, a(8)=9.
- Georg Cantor, Über unendliche, lineare Punktmannigfaltigkeiten V" [On infinite, linear point-manifolds (sets), Part 5]. Mathematische Annalen (in German). (1883) 21: 545-591.
- Paul du Bois-Reymond, Der Beweis des Fundamentalsatzes der Integralrechnung, Mathematische Annalen (in German), (1880), 16, footnote on p. 128.
- Eric Weisstein's World of Mathematics, Cantor Set
- Wikipedia, Cantor set
- Index entries for 3-automatic sequences.
-
A306556(n) = {sm=0;while(n>1,ex=floor(log(n)/log(2));if(n-2^ex==0,sm=sm+3^(ex-1),sm=sm+2*3^(ex-1));n=n-2^ex);return(sm)}
-
a(n) = n--; fromdigits(binary(n>>1),3)*2 + (n%2); \\ Kevin Ryde, Apr 23 2021
A307744
A fractal function, related to ruler functions and the Cantor set. a(1) = 0; for m >= 0, a(3m) = 1; for m >= 1, a(3m-1) = a(m-1) + sign(a(m-1)), a(3m+1) = a(m+1) + sign(a(m+1)).
Original entry on oeis.org
1, 0, 2, 1, 3, 0, 1, 2, 3, 1, 4, 2, 1, 0, 4, 1, 2, 0, 1, 3, 2, 1, 4, 3, 1, 2, 4, 1, 5, 2, 1, 3, 5, 1, 2, 3, 1, 0, 2, 1, 5, 0, 1, 2, 5, 1, 3, 2, 1, 0, 3, 1, 2, 0, 1, 4, 2, 1, 3, 4, 1, 2, 3, 1, 5, 2, 1, 4, 5, 1, 2, 4, 1, 3, 2, 1, 5, 3, 1, 2, 5, 1, 6, 2, 1
Offset: 0
As 4 is congruent to 1 modulo 3, a(4) = a(3*1 + 1) = a(1+1) + sign (a(1+1)) = a(2) + sign(a(2)).
As 2 is congruent to -1 modulo 3, a(2) = a(3*1 - 1) = a(1-1) + sign (a(1-1)) = a(0) + sign(a(0)).
As 0 is congruent to 0 modulo 3, a(0) = 1. So a(2) = a(0) + sign(a(0)) = 1 + 1 = 2. So a(4) = a(2) + sign(a(2)) = 2 + 1 = 3.
For any m, the sequence from 9m - 9 to 9m + 9 can be represented by the table below. x, y and z represent distinct integers unless m = 0, in which case x = z = 0. Distinct values are shown in their own column to highlight patterns.
n a(n)
9m-9 1
9m-8 y - starts pattern (9m-8, 9m-4, 9m+4, 9m+8)
9m-7 2
9m-6 1
9m-5 x
9m-4 y
9m-3 1
9m-2 2
9m-1 x - ends pattern (9m-17, 9m-13, 9m-5, 9m-1)
9m 1
9m+1 z - starts pattern (9m+1, 9m+5, 9m+13, 9m+17)
9m+2 2
9m+3 1
9m+4 y
9m+5 z
9m+6 1
9m+7 2
9m+8 y - ends pattern (9m-8, 9m-4, 9m+4, 9m+8)
9m+9 1
For all m, one of x, y, z represents 3 in this table. Note the identical patterns indicated for "x", "y", "z" quadruples, and how the "x" quadruple ends 2 before the "z" quadruple starts, with the "y" quadruple overlapping both. For k >= 1, there are equivalent 2^k-tuples that overlap similarly, notably (3m-2, 3m+2) for all m.
Larger 2^k-tuples look more fractal, more obviously related to the Cantor set. See the pin plot of a(0..162) aligned above an inverted plot of ruler function A051064 in the links. 0's are emphasized with a fainter line running off the top of the plot, partly because 0 is used here as a conventional value and occurs with some properties (such as zero asymptotic density) that could be considered appropriate to the largest rather than smallest value in the sequence.
The table below illustrates the symmetries of scale of this sequence and ruler function A051064. Note the column for this sequence is indexed by k+1, 3k+1, 9k+1, whereas that for A051064 is indexed by k, 3k, 9k.
a(n+1) A051064(n)
n=k, k=16..27 0,1,3,2,1,4,3,1,2,4,1,5 1,1,3,1,1,2,1,1,2,1,1,4
n=3k,k=16..27 0,2,4,3,2,5,4,2,3,5,2,6 2,2,4,2,2,3,2,2,3,2,2,5
n=9k,k=16..27 0,3,5,4,3,6,5,3,4,6,3,7 3,3,5,3,3,4,3,3,4,3,3,6
-
a(n) = if (n==1, 0, my(m=n%3); if (m==0, 1, my(kk = (if (m==1, a(n\3+1), a((n-2)\3)))); kk + sign(kk)));
for (n=0, 100, print1(a(n), ", ")) \\ Michel Marcus, Jul 06 2019
A309054
a(1) = 0; for m >= 0, a(3m) = 1; for m >= 1, a(3m-1) = 2*a(m-1), a(3m+1) = 2*a(m+1).
Original entry on oeis.org
1, 0, 2, 1, 4, 0, 1, 2, 4, 1, 8, 2, 1, 0, 8, 1, 2, 0, 1, 4, 2, 1, 8, 4, 1, 2, 8, 1, 16, 2, 1, 4, 16, 1, 2, 4, 1, 0, 2, 1, 16, 0, 1, 2, 16, 1, 4, 2, 1, 0, 4, 1, 2, 0, 1, 8, 2, 1, 4, 8, 1, 2, 4, 1, 16, 2, 1, 8, 16, 1, 2, 8, 1, 4, 2, 1, 16, 4, 1, 2, 16, 1, 32, 2, 1
Offset: 0
As 4 is congruent to 1 modulo 3, a(4) = a(3*1 + 1) = 2*a(1+1) = 2*a(2).
As 2 is congruent to -1 modulo 3, a(2) = a(3*1 - 1) = 2*a(1-1) = 2*a(0).
As 0 is congruent to 0 modulo 3, a(0) = 1. So a(2) = 2*a(0) = 2*1 = 2. So a(4) = 2*a(2) = 2*2 = 4.
A355680
Numerator generator for offsets from the quarter points of the Cantor ternary set to the center points of deleted middle thirds: 1 is in the list and if m is in the list -3m-4 and -3m+4 are in the list, which is ordered by absolute value.
Original entry on oeis.org
1, -7, 17, 25, -47, -55, -71, -79, 137, 145, 161, 169, 209, 217, 233, 241, -407, -415, -431, -439, -479, -487, -503, -511, -623, -631, -647, -655, -695, -703, -719, -727, 1217, 1225, 1241, 1249, 1289, 1297, 1313, 1321, 1433, 1441, 1457, 1465, 1505, 1513, 1529, 1537, 1865
Offset: 1
At the 2nd step of generating the Cantor set, the deleted middle thirds are (1/9, 2/9) and (7/9, 8/9) with center points 1/6 and 5/6. These points are offset from 1/4 by -1/12 and +7/12. The denominator for the 2nd step (i.e., k=1) is 4*(-3)^k = -12. So a(1) = -1 * -1 = 1 and a(2) = 7 * -1 = -7.
- Eric Weisstein's World of Mathematics, Cantor Set.
Essentially, the positions of isolated 0's in
A355682.
-
A355680(size) = {a=vector(size); a[1] = 1;
forstep (n=2,size,2, j=-3*a[n\2];
if(j>0, a[n-1]=j-4;a[n]=j+4, a[n-1]=j+4;a[n]=j-4);
print(n-1," ",a[n-1]); print(n," ",a[n]);) }
Showing 1-8 of 8 results.
Comments