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.

Showing 1-3 of 3 results.

A328728 a(n) = Sum_{k = 0..w and t_k > 0} (-1)^t_k * 2^k, where Sum_{k = 0..w} t_k * 3^k is the ternary representation of A328727(n).

Original entry on oeis.org

0, -1, 1, -2, 2, -4, -5, -3, 4, 3, 5, -8, -9, -7, -10, -6, 8, 7, 9, 6, 10, -16, -17, -15, -18, -14, -20, -21, -19, -12, -13, -11, 16, 15, 17, 14, 18, 12, 11, 13, 20, 19, 21, -32, -33, -31, -34, -30, -36, -37, -35, -28, -29, -27, -40, -41, -39, -42, -38, -24
Offset: 1

Views

Author

Rémy Sigrist, Oct 26 2019

Keywords

Comments

Every integer appears once in the sequence.

Crossrefs

Programs

  • PARI
    for (n=0, 297, t = Vecrev(digits(n,3)); if (sum(k=1, #t-1, t[k]*t[k+1])==0, print1 (sum(k=1, #t, if (t[k], 2^k*(-1)^t[k], 0)/2) ", ")))
    
  • Python
    from itertools import count, islice
    from gmpy2 import digits
    def A328728_gen(startvalue=0): # generator of terms >= startvalue
        for n in count(max(startvalue,0)):
            s = digits(n,3)
            for i in range(len(s)-1):
                if '0' not in s[i:i+2]:
                    break
            else:
                yield sum((-(1<A328728_list = list(islice(A328728_gen(),20)) # Chai Wah Wu, Apr 12 2023

Formula

a(n) = A328749(A328727(n)).
Sum_{k = 1..n} a(k) = 0 iff n belongs to A001045.

A362089 The base-3 expansion of a(n) is obtained by inserting a zero before each nonzero digit of the base-3 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 10, 11, 6, 19, 20, 9, 28, 29, 30, 91, 92, 33, 100, 101, 18, 55, 56, 57, 172, 173, 60, 181, 182, 27, 82, 83, 84, 253, 254, 87, 262, 263, 90, 271, 272, 273, 820, 821, 276, 829, 830, 99, 298, 299, 300, 901, 902, 303, 910, 911, 54, 163, 164, 165, 496
Offset: 0

Views

Author

Rémy Sigrist, Apr 08 2023

Keywords

Comments

This sequence is a permutation of A328727.

Examples

			The first terms, in decimal and in base-3, are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2       2          2
   3     3      10         10
   4    10      11        101
   5    11      12        102
   6     6      20         20
   7    19      21        201
   8    20      22        202
   9     9     100        100
  10    28     101       1001
  11    29     102       1002
  12    30     110       1010
		

Crossrefs

Cf. A007089 (ter(n)), A048678, A328727, A362090.

Programs

  • PARI
    a(n) = { if (n==0, 0, n%3, 9*a(n\3) + n%3, 3*a(n/3)); }
    
  • Python
    from gmpy2 import digits
    def A362089(n): return int(digits(n,3).replace('1','01').replace('2','02'),3)
    # Chai Wah Wu, Apr 12 2023

A350776 Nonnegative integers whose balanced ternary expansion has no two consecutive nonzero digits.

Original entry on oeis.org

0, 1, 3, 8, 9, 10, 24, 26, 27, 28, 30, 71, 72, 73, 78, 80, 81, 82, 84, 89, 90, 91, 213, 215, 216, 217, 219, 233, 234, 235, 240, 242, 243, 244, 246, 251, 252, 253, 267, 269, 270, 271, 273, 638, 639, 640, 645, 647, 648, 649, 651, 656, 657, 658, 699, 701, 702
Offset: 1

Views

Author

Rémy Sigrist, Jan 15 2022

Keywords

Comments

This sequence is to balanced ternary what A328727 is to ternary.

Examples

			The first terms, in decimal and in balanced ternary, are:
  n   a(n)  bter(n)
  --  ----  -------
   1     0        0
   2     1        1
   3     3       10
   4     8      10T
   5     9      100
   6    10      101
   7    24     10T0
   8    26     100T
   9    27     1000
  10    28     1001
  11    30     1010
  12    71    10T0T
		

Crossrefs

Programs

  • PARI
    is(n) = { my (p=0, d); while (n, d=[0, 1, -1][1+n%3]; if (p && d, return (0), n=(n-d)/3; p=d)); 1 }

Formula

A350775(n) = 0 iff n belongs to the present sequence.
Showing 1-3 of 3 results.