cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Previous Showing 11-20 of 48 results. Next

A289813 A binary encoding of the ones in ternary representation of n (see Comments for precise definition).

Original entry on oeis.org

0, 1, 0, 2, 3, 2, 0, 1, 0, 4, 5, 4, 6, 7, 6, 4, 5, 4, 0, 1, 0, 2, 3, 2, 0, 1, 0, 8, 9, 8, 10, 11, 10, 8, 9, 8, 12, 13, 12, 14, 15, 14, 12, 13, 12, 8, 9, 8, 10, 11, 10, 8, 9, 8, 0, 1, 0, 2, 3, 2, 0, 1, 0, 4, 5, 4, 6, 7, 6, 4, 5, 4, 0, 1, 0, 2, 3, 2, 0, 1, 0, 16
Offset: 0

Views

Author

Rémy Sigrist, Jul 12 2017

Keywords

Comments

The ones in the binary representation of a(n) correspond to the ones in the ternary representation of n; for example: ternary(42) = 1120 and binary(a(42)) = 1100 (a(42) = 12).
See A289814 for the sequence encoding the twos in ternary representation of n.
By design, a(n) AND A289814(n) = 0 (where AND stands for the bitwise AND operator).
See A289831 for the sum of this sequence and A289814.
For each pair of numbers without common bits in base 2 representation, say x and y, there is a unique index, say n, such that a(n) = x and A289814(n) = y; in fact, n = A289869(x,y).
The scatterplot of this sequence vs A289814 looks like a Sierpinski triangle pivoted to the side.
For any t > 0: we can adapt the algorithm used here and in A289814 in order to uniquely enumerate every tuple of t numbers mutually without common bits in base 2 representation.

Examples

			The first values, alongside the ternary representation of n, and the binary representation of a(n), are:
n       a(n)    ternary(n)  binary(a(n))
--      ----    ----------  ------------
0       0       0           0
1       1       1           1
2       0       2           0
3       2       10          10
4       3       11          11
5       2       12          10
6       0       20          0
7       1       21          1
8       0       22          0
9       4       100         100
10      5       101         101
11      4       102         100
12      6       110         110
13      7       111         111
14      6       112         110
15      4       120         100
16      5       121         101
17      4       122         100
18      0       200         0
19      1       201         1
20      0       202         0
21      2       210         10
22      3       211         11
23      2       212         10
24      0       220         0
25      1       221         1
26      0       222         0
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[#, 2] &[IntegerDigits[n, 3] /. 2 -> 0], {n, 0, 81}] (* Michael De Vlieger, Jul 20 2017 *)
  • PARI
    a(n) = my (d=digits(n,3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2)
    
  • PARI
    a(n) = fromdigits(digits(n, 3)%2, 2); \\ Ruud H.G. van Tol, May 08 2024
    
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        d = digits(n, 3)[1:]
        return int("".join('1' if i==1 else '0' for i in d), 2)
    print([a(n) for n in range(51)]) # Indranil Ghosh, Jul 20 2017

Formula

a(0) = 0.
a(3*n) = 2 * a(n).
a(3*n+1) = 2 * a(n) + 1.
a(3*n+2) = 2 * a(n).
Also, a(n) = A289814(A004488(n)).
A053735(n) = A000120(a(n)) + 2*A000120(A289814(n)). - Antti Karttunen, Jul 20 2017

A291759 Binary encoding of 2-digits in ternary representation of A048673(n).

Original entry on oeis.org

0, 1, 0, 1, 0, 3, 2, 1, 0, 1, 2, 5, 0, 3, 4, 1, 0, 1, 0, 1, 0, 5, 2, 9, 6, 7, 8, 5, 2, 7, 4, 1, 2, 1, 0, 1, 4, 3, 2, 1, 4, 1, 6, 9, 2, 3, 0, 17, 10, 13, 4, 13, 0, 23, 4, 9, 8, 5, 0, 13, 2, 9, 8, 1, 10, 3, 0, 1, 12, 3, 0, 1, 0, 11, 2, 5, 12, 5, 2, 1, 10, 9, 4, 1, 8, 11, 14, 17, 4, 5, 0, 5, 0, 15, 0, 33, 6, 21, 16, 25, 6, 11, 8, 25, 16, 3, 8, 45, 8, 9, 4, 17, 8
Offset: 1

Views

Author

Antti Karttunen, Sep 12 2017

Keywords

Crossrefs

Formula

a(n) = A289814(A048673(n)).

A293226 Restricted growth sequence transform of A293225, a filter combining two products, the other formed from the 1-digits (A293221) and the other from the 2-digits (A293222) present in the ternary expansions of proper divisors of n.

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 2, 5, 6, 7, 2, 8, 2, 9, 10, 11, 2, 12, 2, 13, 14, 15, 2, 16, 4, 17, 18, 19, 2, 20, 2, 21, 22, 23, 24, 25, 2, 26, 27, 28, 2, 29, 2, 30, 31, 32, 2, 33, 34, 35, 12, 36, 2, 37, 38, 39, 40, 41, 2, 42, 2, 43, 44, 45, 46, 47, 2, 48, 49, 50, 2, 51, 2, 52, 53, 54, 55, 56, 2, 57, 58, 59, 2, 60, 61, 62, 63, 64, 2, 65, 66, 67, 68, 69, 70, 71, 2, 72
Offset: 1

Views

Author

Antti Karttunen, Oct 03 2017

Keywords

Comments

For all i, j: a(i) = a(j) => A001065(i) = A001065(j).

Crossrefs

Programs

  • PARI
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A289813(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2); };
    A289814(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2); };
    A293221(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289813(d)))); m; };
    A293222(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(d)))); m; };
    Anot_submitted(n) = (1/2)*(2 + ((A293222(n) + A293221(n))^2) - A293222(n) - 3*A293221(n)); \\ Eq.class-wise equal to A293225.
    write_to_bfile(1,rgs_transform(vector(19683,n,Anot_submitted(n))),"b293226.txt");

A290093 Compound filter (for base-3 digit runlengths): a(n) = P(A290091(n), A290092(n)), where P(n,k) is sequence A000027 used as a pairing function.

Original entry on oeis.org

1, 3, 2, 3, 10, 5, 2, 5, 7, 3, 21, 5, 10, 36, 14, 5, 27, 12, 2, 5, 16, 5, 14, 23, 7, 12, 29, 3, 21, 5, 21, 78, 27, 5, 27, 12, 10, 78, 14, 36, 136, 44, 14, 90, 25, 5, 27, 23, 27, 90, 61, 12, 42, 38, 2, 5, 16, 5, 14, 23, 16, 23, 67, 5, 27, 23, 14, 44, 40, 23, 61, 80, 7, 12, 67, 12, 25, 80, 29, 38, 121, 3, 21, 5, 21, 78, 27, 5, 27, 12, 21, 465, 27, 78, 300, 90, 27
Offset: 0

Views

Author

Antti Karttunen, Jul 25 2017

Keywords

Comments

For all i, j: a(i) = a(j) => A006047(i) = A006047(j) => A053735(i) = A053735(j).

Crossrefs

Cf. A006047, A053735, A290079 (some of the matched sequences).

Programs

Formula

a(n) = (1/2)*(2 + ((A290091(n)+A290092(n))^2) - A290091(n) - 3*A290092(n)).

A291770 A binary encoding of the zeros in ternary representation of n.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 0, 0, 1, 0, 0, 7, 6, 6, 5, 4, 4, 5, 4, 4, 3, 2, 2, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 0, 0, 1, 0, 0, 7, 6, 6, 5, 4, 4, 5, 4, 4, 3, 2, 2, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 0, 0, 1, 0, 0, 15, 14, 14, 13, 12, 12, 13, 12, 12, 11, 10, 10, 9, 8, 8, 9, 8, 8, 11, 10, 10, 9, 8, 8, 9, 8, 8, 7, 6, 6
Offset: 1

Views

Author

Antti Karttunen, Sep 11 2017

Keywords

Comments

The ones in the binary representation of a(n) correspond to the nonleading zeros in the ternary representation of n. For example: ternary(33) = 1020 and binary(a(33)) = 101 (a(33) = 5).

Examples

			   n      a(n)    ternary(n)  binary(a(n))
                  A007089(n)  A007088(a(n))
  --      ----    ----------  ------------
   1        0            1           0
   2        0            2           0
   3        1           10           1
   4        0           11           0
   5        0           12           0
   6        1           20           1
   7        0           21           0
   8        0           22           0
   9        3          100          11
  10        2          101          10
  11        2          102          10
  12        1          110           1
  13        0          111           0
  14        0          112           0
  15        1          120           1
  16        0          121           0
  17        0          122           0
  18        3          200          11
  19        2          201          10
  20        2          202          10
  21        1          210           1
  22        0          211           0
  23        0          212           0
  24        1          220           1
  25        0          221           0
  26        0          222           0
  27        7         1000         111
  28        6         1001         110
  29        6         1002         110
  30        5         1010         101
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n, 3] /. k_ /; k < 3 :> If[k == 0, 1, 0], 2], {n, 110}] (* Michael De Vlieger, Sep 11 2017 *)
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        k=digits(n, 3)[1:]
        return int("".join('1' if i==0 else '0' for i in k), 2)
    print([a(n) for n in range(1, 111)]) # Indranil Ghosh, Sep 21 2017
  • Scheme
    (define (A291770 n) (if (zero? n) n (let loop ((n n) (b 1) (s 0)) (if (< n 3) s (let ((d (modulo n 3))) (if (zero? d) (loop (/ n 3) (+ b b) (+ s b)) (loop (/ (- n d) 3) (+ b b) s)))))))
    

Formula

For all n >= 0, a(A000244(n)) = A000225(n), that is, a(3^n) = (2^n) - 1. [The records in the sequence].
For all n >= 1, A000120(a(n)) = A077267(n).
For all n >= 1, A278222(a(n)) = A291771(n).

A293224 Restricted growth sequence transform of A293222, a product formed from the 2-digits present in the ternary expansions of proper divisors of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 4, 1, 4, 2, 5, 1, 4, 1, 3, 6, 3, 1, 7, 2, 2, 1, 5, 1, 7, 1, 7, 2, 5, 4, 8, 1, 9, 1, 10, 1, 11, 1, 12, 4, 12, 1, 13, 6, 14, 4, 14, 1, 8, 3, 15, 16, 3, 1, 17, 1, 2, 18, 15, 2, 11, 1, 7, 9, 19, 1, 20, 1, 2, 21, 12, 4, 11, 1, 22, 1, 3, 1, 23, 5, 4, 2, 22, 1, 24, 6, 25, 1, 12, 9, 26, 1, 14, 4, 27, 1, 13, 1, 28, 23, 14, 1, 29, 1, 30
Offset: 1

Views

Author

Antti Karttunen, Oct 03 2017

Keywords

Crossrefs

Programs

  • PARI
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A289814(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From Remy Sigrist
    A293222(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(d)))); m; };
    write_to_bfile(1,rgs_transform(vector(19683,n,A293222(n))),"b293224.txt");

A244042 In ternary representation of n, replace 2's with 0's.

Original entry on oeis.org

0, 1, 0, 3, 4, 3, 0, 1, 0, 9, 10, 9, 12, 13, 12, 9, 10, 9, 0, 1, 0, 3, 4, 3, 0, 1, 0, 27, 28, 27, 30, 31, 30, 27, 28, 27, 36, 37, 36, 39, 40, 39, 36, 37, 36, 27, 28, 27, 30, 31, 30, 27, 28, 27, 0, 1, 0, 3, 4, 3, 0, 1, 0, 9, 10, 9, 12, 13, 12, 9, 10, 9
Offset: 0

Views

Author

Joonas Pohjonen, Jun 17 2014

Keywords

Examples

			16 = 121_3, replacing 2 with 0 gives 101_3 = 10, so a(16) = 10.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local t, r, i; t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+3^i*(d-> `if`(d=2, 0, d))(irem(t, 3, 't'))
          od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Jun 17 2014
  • Mathematica
    Array[FromDigits[IntegerDigits[#, 3] /. 2 -> 0, 3] &, 72, 0] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    a(n) = my(d=digits(n, 3)); fromdigits(apply(x->(if (x==2, 0, x)), d), 3); \\ Michel Marcus, Jun 10 2017
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):return int("".join(map(str, digits(n, 3)[1:])).replace('2', '0'), 3) # Indranil Ghosh, Jun 10 2017
    

Formula

a(n) = n - 2 * A005836(A289814(n) + 1) = A005836(A289813(n) + 1). - Andrey Zabolotskiy, Nov 11 2019

A291760 Binary encoding of 2-digits in ternary representation of A254103(n).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 3, 2, 1, 0, 1, 2, 5, 0, 3, 0, 1, 4, 7, 2, 1, 4, 5, 0, 9, 0, 1, 4, 5, 0, 1, 2, 1, 8, 9, 2, 13, 0, 3, 6, 1, 4, 7, 0, 9, 0, 3, 4, 17, 4, 7, 8, 1, 8, 11, 2, 9, 12, 15, 2, 1, 4, 5, 6, 1, 20, 23, 2, 17, 4, 5, 6, 25, 0, 1, 10, 5, 8, 11, 0, 1, 8, 9, 12, 13, 0, 1, 2, 17, 0, 1, 4, 5, 8, 9, 0, 33, 8, 9, 12, 13, 16, 17, 0, 1, 16, 17, 2, 21, 0, 3, 6, 17
Offset: 0

Views

Author

Antti Karttunen, Sep 12 2017

Keywords

Crossrefs

Formula

a(n) = A289814(A254103(n)).

A291763 Binary encoding of 2-digits in ternary representation of A245612(n).

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 3, 0, 1, 8, 1, 6, 5, 4, 1, 2, 1, 10, 23, 16, 1, 2, 13, 10, 9, 2, 7, 0, 1, 0, 3, 2, 1, 70, 21, 24, 45, 4, 33, 52, 1, 36, 3, 20, 25, 10, 21, 0, 17, 18, 5, 0, 13, 16, 3, 12, 1, 8, 1, 4, 5, 2, 5, 0, 1, 32, 139, 74, 41, 208, 49, 0, 89, 108, 11, 130, 65, 18, 103, 4, 1, 8, 73, 4, 5, 112, 41, 16, 49, 72, 19, 38, 41, 20, 1, 8, 33, 0, 35, 86, 9, 38
Offset: 0

Views

Author

Antti Karttunen, Sep 12 2017

Keywords

Crossrefs

Formula

a(n) = A289814(A245612(n)).

A293225 Compound filter: a(n) = P(A293224(n), A293223(n)), where P(n,k) is sequence A000027 used as a pairing function.

Original entry on oeis.org

1, 2, 2, 5, 2, 8, 2, 12, 4, 13, 2, 32, 2, 40, 30, 33, 2, 59, 2, 58, 42, 69, 2, 143, 8, 80, 29, 83, 2, 178, 2, 197, 38, 96, 25, 239, 2, 100, 121, 163, 2, 221, 2, 202, 194, 103, 2, 448, 61, 365, 59, 245, 2, 333, 48, 576, 187, 256, 2, 720, 2, 278, 546, 718, 138, 606, 2, 503, 114, 1009, 2, 1101, 2, 437, 651, 678, 532, 831, 2, 1400, 172, 213, 2, 1508, 71, 500, 597
Offset: 1

Views

Author

Antti Karttunen, Oct 03 2017

Keywords

Crossrefs

Cf. A000027, A019565, A293221, A293222, A293223, A293224, A293226 (rgs-version of this filter).

Programs

  • PARI
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A289813(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2); };
    A289814(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2); };
    A293221(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289813(d)))); m; };
    A293222(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(d)))); m; };
    v293223 = rgs_transform(vector(19683,n,A293221(n)));
    A293223(n) = v293223[n];
    v293224 = rgs_transform(vector(19683,n,A293222(n)));
    A293224(n) = v293224[n];
    A293225(n) = (1/2)*(2 + ((A293224(n) + A293223(n))^2) - A293224(n) - 3*A293223(n));
    
  • Scheme
    (define (A293225 n) (* 1/2 (+ (expt (+ (A293224 n) (A293223 n)) 2) (- (A293224 n)) (- (* 3 (A293223 n))) 2)))

Formula

a(n) = (1/2)*(2 + ((A293224(n) + A293223(n))^2) - A293224(n) - 3*A293223(n)).
Previous Showing 11-20 of 48 results. Next