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-2 of 2 results.

A340258 Lexicographically earliest sequence of distinct positive terms such that for any n > 0, n + a(n) is digitally balanced.

Original entry on oeis.org

1, 7, 6, 5, 4, 3, 2, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 28, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69
Offset: 1

Views

Author

Rémy Sigrist, Jan 02 2021

Keywords

Comments

Digitally balanced numbers correspond to A031443.
This sequence is a self-inverse permutation of the natural numbers.

Examples

			The first terms, alongside the binary representation of n + a(n), are:
  n   a(n)  bin(n + a(n))
  --  ----  -------------
   1     1             10
   2     7           1001
   3     6           1001
   4     5           1001
   5     4           1001
   6     3           1001
   7     2           1001
   8    27         100011
   9    26         100011
  10    25         100011
  11    24         100011
  12    23         100011
  13    22         100011
		

Crossrefs

Cf. A031443, A306993 (multiplicative variant).

Programs

  • PARI
    See Links section.
    
  • Python
    def aupto(n):
      alst, aset = [], set()
      for k in range(1, n+1):
        ak = 1
        while True:
          while ak in aset: ak += 1
          binakplusk = bin(ak+k)[2:]
          if binakplusk.count("0")==binakplusk.count("1"): break
          ak += 1
        alst.append(ak)
        aset.add(ak)
      return alst
    print(aupto(66)) # Michael S. Branicky, Jan 02 2021

A355642 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the balanced ternary expansion of n * a(n) contains as many negative trits as positive trits.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jul 11 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			The first terms, alongside the balanced ternary expansion of n * a(n), are:
  n   a(n)  bter(n*a(n))
  --  ----  ------------
   0     0             0
   1     2            1T
   2     1            1T
   3     6          1T00
   4     4          1TT1
   5    12         1T1T0
   6     3          1T00
   7     8         1T01T
   8     7         1T01T
   9    16        1TT100
  10    13        1TTT11
  11    14        1T0T01
  12     5         1T1T0
		

Crossrefs

See A306993 for a similar sequence.

Programs

  • PARI
    See Links section.
Showing 1-2 of 2 results.