A019989
Indices n such that A307672(2*n) = 0.
Original entry on oeis.org
2, 5, 6, 8, 14, 15, 16, 18, 20, 23, 24, 26, 35, 41, 42, 43, 45, 47, 48, 49, 52, 54, 56, 59, 60, 62, 68, 69, 70, 72, 74, 77, 78, 80, 91, 98, 104, 105, 107, 116, 122, 123, 124, 126, 128, 129, 130, 133, 135, 137, 140, 141, 142, 144, 146, 147, 148, 154, 156
Offset: 0
-
iterate[sets_] := With[{ind = {{1, 5, 6}, {2, 6, 4}, {3, 4, 5}, {4, 3, 2}, {5, 1, 3}, {6, 2, 1}} }, Union @@ (3*sets[[#]] + {0, -1, 1}) & /@ ind];
Part[Union @@ # & /@ Transpose[NestList[iterate, Append[Table[{}, 5], {1}], 10]], 1, 1 ;; 59]/2 (* Bradley Klee, Apr 15 2019 *) FractusRadius = {0 -> {4, 0, 5}, 1 -> {5, 1, 3}, 2 -> {3, 2, 4}, 3 -> {2, 3, 1}, 4 -> {0, 4, 2}, 5 -> {1, 5, 0}};
aR0[n_] := Flatten[Position[ Nest[Part[Flatten[# /. FractusRadius], 2 ;; -1] &, {0}, n], 0] - 1][[2 ;; -1]]/2; aR0[5](* Bradley Klee, Apr 16 2019 *)
A019990
Indices n such that A307672(2*n) = 2.
Original entry on oeis.org
1, 3, 4, 7, 9, 11, 12, 13, 19, 21, 22, 25, 27, 29, 32, 33, 34, 36, 38, 39, 40, 46, 55, 57, 58, 61, 63, 65, 66, 67, 73, 75, 76, 79, 81, 83, 86, 87, 89, 95, 96, 97, 99, 101, 102, 103, 106, 108, 110, 113, 114, 115, 117, 119, 120, 121, 127, 136, 138, 139, 145
Offset: 0
A019991
Indices n such that A307672(2*n) = 4.
Original entry on oeis.org
10, 17, 28, 30, 31, 37, 44, 50, 51, 53, 64, 71, 82, 84, 85, 88, 90, 92, 93, 94, 100, 109, 111, 112, 118, 125, 131, 132, 134, 143, 149, 150, 151, 153, 155, 158, 159, 161, 172, 179, 190, 192, 193, 199, 206, 212, 213, 215, 226, 233, 244, 246, 247, 250
Offset: 0
A156595
Fixed point of the morphism 0->011, 1->010.
Original entry on oeis.org
0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0
Offset: 0
0 -> 0,1,1 -> 0,1,1,0,1,0,0,1,0 -> ...
- M. Lothaire, Combinatorics on words.
- J.-P. Allouche and R. Bacher, Toeplitz Sequences, Paperfolding, Towers of Hanoi, and Progression-Free Sequences of Integers, L'Enseignement Mathématique, volume 38, pages 315-327, 1992.
- Joerg Arndt, Matters Computational (The Fxtbook) (section 1.31.5 "Dragon curves based on radix-R counting", pp. 95-101, image on p. 101).
- Gabriele Fici and Jeffrey Shallit, Properties of a Class of Toeplitz Words, arXiv:2112.12125 [cs.FL], 2021.
- Kevin Ryde, Iterations of the Terdragon Curve, see index "AltTurnRpred" with AltTurnRpred(n) = a(n-1).
- Index entries for sequences that are fixed points of mappings
Cf.
A307672 (draws curves that align with the Sierpinski gasket).
-
Nest[ Flatten[ # /. {0 -> {0, 1, 1}, 1 -> {0, 1, 0}}] &, {0}, 10]
SubstitutionSystem[{0->{0,1,1},1->{0,1,0}},0,{5}][[1]] (* Harvey P. Dale, Jan 15 2022 *)
-
from sympy import integer_log
def A156595(n): return sum(((m:=(n+1)//9**i)-2)//9+(m-3)//9+(m-5)//9+(m-8)//9+4 for i in range(integer_log(n+1,9)[0]+1))-sum(((m:=n//9**i)-2)//9+(m-3)//9+(m-5)//9+(m-8)//9+4 for i in range(integer_log(n,9)[0]+1)) if n else 0 # Chai Wah Wu, Feb 16 2025
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.
A308364
a(0) = 0, a(3n) = a(n), a(3n+1) = a(n)*3 + 1, a(3n-1) = a(n)*3 - 1.
Original entry on oeis.org
0, 1, 2, 1, 4, 5, 2, 7, 2, 1, 4, 11, 4, 13, 14, 5, 16, 5, 2, 7, 20, 7, 22, 5, 2, 7, 2, 1, 4, 11, 4, 13, 32, 11, 34, 11, 4, 13, 38, 13, 40, 41, 14, 43, 14, 5, 16, 47, 16, 49, 14, 5, 16, 5, 2, 7, 20, 7, 22, 59, 20, 61, 20, 7, 22, 65, 22, 67, 14, 5, 16, 5, 2, 7, 20, 7, 22, 5, 2, 7, 2, 1
Offset: 0
As 6 is congruent to 0 modulo 3, a(6) = a(3*2) = a(2).
As 2 is congruent to -1 modulo 3, a(2) = a(3*1 - 1) = a(1)*3 - 1.
As 1 is congruent to 1 modulo 3, a(1) = a(0*1 + 1) = a(0)*3 + 1 = 0*3 + 1 = 1.
So a(2) = a(1)*3 - 1 = 1*3 - 1 = 2. So a(6) = a(2) = 2.
-
a:=[1]; for n in [2..80] do if n mod 3 eq 2 then a[n]:= 3*a[(n+1) div 3]-1; end if; if n mod 3 eq 1 then a[n]:=3*a[(n-1) div 3]+1; end if; if n mod 3 eq 0 then a[n]:=a[n div 3]; end if; end for; [0] cat a; // Marius A. Burtea, Nov 14 2019
-
a(n) = if (n == 0, 0, r = n%3; if (r==0, a(n/3), if (r==1, 3*a((n-1)/3)+1, 3*a((n+1)/3)-1))); \\ Michel Marcus, May 29 2019
A334483
a(n) is the X-coordinate of the n-th point of the Sierpinski arrowhead curve; sequence A334484 gives Y-coordinates.
Original entry on oeis.org
0, 1, 1, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 6, 5, 4, 4, 3, 2, 2, 1, 0, 0, 1, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 1, 0, 0, 1, 2, 2, 3, 4, 5, 5, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 10, 9, 8, 8, 9, 9, 8, 8, 9, 10, 10, 11, 12, 13, 13, 12, 12, 13, 14, 14, 15
Offset: 0
The Sierpinski arrowhead curve starts (on a hexagonal lattice) as follows:
+
27\
\
+
/26
/
+----+
/24 25
/
+ +----+
23\ /20 19\
\ / \
+----+ +
22 21 /18
/
+----+ +
/4 5\ 17\
/ \ \
+ + +----+
3\ /6 16 15\
\ / \
+ + +----+ +
/2 7\ /10 11\ /14
/ \ / \ /
+----+ +----+ +----+
0 1 8 9 12 13
- hence a(6) = a(7) = a(20) = a(21) = 2.
A108964
Write n in balanced ternary notation, omit any zeros and form the left-to-right alternating sum mod 3.
Original entry on oeis.org
0, 1, 2, 1, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 2, 1, 0, 1, 2, 0, 1, 0, 2, 1, 2, 0, 2, 1, 0, 2, 0, 1, 0, 2, 1, 2, 0, 1, 2, 1, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 2, 1, 0, 1, 2, 0, 1, 0, 2, 0, 1, 2, 1, 0, 2, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 0, 2, 1, 2, 0, 2, 1, 0, 2, 0, 1, 0, 2, 1, 2, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 0, 1, 2, 0, 2
Offset: 0
1="1", so a(1)=1; 2=3-1="1,-1", so a(2)=2; 3=3="1,0", so a(3)=1; 4=3+1="1,1", so a(4)=0; ...
-
a:= proc(n) local d, i, m, l; m:=n; l:=[];
for i from 0 while m>0 do
d:= irem(m, 3, 'm');
if d=2 then m:=m+1; d:=-1 fi;
if d<>0 then l:=[d, l[]] fi
od;
add(l[i]*(-1)^(i-1), i=1..nops(l)) mod 3
end:
seq(a(n), n=0..105); # Alois P. Heinz, May 11 2015
-
a[n_] := Module[{d, i, m = n, l = {}}, For[i = 0, m>0, i++, d = Mod[m, 3]; m = Quotient[m, 3]; If[d==2, m++; d = -1]; If[d != 0, l = Prepend[l, d]]]; Mod[Sum[l[[i]] (-1)^(i-1), {i, 1, Length[l]}], 3]];
a /@ Range[0, 105] (* Jean-François Alcover, Nov 18 2020, after Alois P. Heinz *)
Showing 1-9 of 9 results.
Comments