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

A278219 Filter-sequence related to base-2 run-length encoding: a(n) = A046523(A243353(n)).

Original entry on oeis.org

1, 2, 4, 2, 4, 8, 6, 2, 4, 12, 16, 8, 6, 12, 6, 2, 4, 12, 36, 12, 16, 32, 24, 8, 6, 30, 24, 12, 6, 12, 6, 2, 4, 12, 36, 12, 36, 72, 60, 12, 16, 48, 64, 32, 24, 72, 24, 8, 6, 30, 60, 30, 24, 48, 60, 12, 6, 30, 24, 12, 6, 12, 6, 2, 4, 12, 36, 12, 36, 72, 60, 12, 36, 180, 144, 72, 60, 180, 60, 12, 16, 48, 144, 48, 64, 128, 96, 32, 24, 120, 216, 72, 24, 72
Offset: 0

Views

Author

Antti Karttunen, Nov 16 2016

Keywords

Crossrefs

Other base-2 related filter sequences: A278217, A278222.
Sequences that (seem to) partition N into same or coarser equivalence classes are at least these: A005811, A136004, A033264, A037800, A069010, A087116, A090079 and many others like A105500, A106826, A166242, A246960, A277561, A037834, A225081 although these have not been fully checked yet.

Programs

  • Mathematica
    f[n_, i_, x_] := Which[n == 0, x, EvenQ@ n, f[n/2, i + 1, x], True, f[(n - 1)/2, i, x Prime@ i]]; g[n_] := If[n == 1, 1, Times @@ MapIndexed[ Prime[First@ #2]^#1 &, Sort[FactorInteger[n][[All, -1]], Greater]]];
    Table[g@ f[BitXor[n, Floor[n/2]], 1, 1], {n, 0, 93}] (* Michael De Vlieger, May 09 2017 *)
  • Python
    from sympy import prime, factorint
    import math
    def A(n): return n - 2**int(math.floor(math.log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    def a005940(n): return b(n - 1)
    def P(n):
        f = factorint(n)
        return sorted([f[i] for i in f])
    def a046523(n):
        x=1
        while True:
            if P(n) == P(x): return x
            else: x+=1
    def a003188(n): return n^int(n/2)
    def a243353(n): return a005940(1 + a003188(n))
    def a(n): return a046523(a243353(n)) # Indranil Ghosh, May 07 2017
  • Scheme
    (define (A278219 n) (A046523 (A243353 n)))
    

Formula

a(n) = A046523(A243353(n)).
a(n) = A278222(A003188(n)).
a(n) = A278220(1+A075157(n)).

A361644 Irregular triangle T(n, k), n >= 0, k = 1..max(1, 2^(A005811(n)-1)), read by rows; the n-th row lists the integers with the same binary length as n and whose partial sums of run lengths are included in those of n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 19 2023

Keywords

Comments

In other words, the n-th row contains the numbers k with the same binary length as n and for any i >= 0, if the i-th bit and the (i+1)-th bit in k are different then they are also different in n (i = 0 corresponding to the least significant bit).
The value m appears 2^A092339(m) times in the triangle (see A361674).

Examples

			Triangle begins (in decimal and in binary):
  n   n-th row      bin(n)  n-th row in binary
  --  ------------  ------  ------------------
   0  0                  0  0
   1  1                  1  1
   2  2, 3              10  10, 11
   3  3                 11  11
   4  4, 7             100  100, 111
   5  4, 5, 6, 7       101  100, 101, 110, 111
   6  6, 7             110  110, 111
   7  7                111  111
   8  8, 15           1000  1000, 1111
   9  8, 9, 14, 15    1001  1000, 1001, 1110, 1111
.
For n = 9:
- the binary expansion of 9 is "1001",
- the corresponding run lengths are 1, 2, 1,
- so the 9th row contains the values with the following run lengths:
      1, 2, 1  ->   9 ("1001" in binary)
      1,  2+1  ->   8 ("1000" in binary)
      1+2,  1  ->  14 ("1110" in binary)
       1+2+1   ->  15 ("1111" in binary)
		

Crossrefs

Programs

  • PARI
    row(n) = { my (r = []); while (n, my (v = valuation(n+n%2, 2)); n \= 2^v; r = concat(v, r)); my (s = [if (#r, 2^r[1]-1, 0)]); for (k = 2, #r, s = concat(s * 2^r[k], [(h+1)*2^r[k]-1|h<-s]);); vecsort(s); }

Formula

T(n, 1) = A342126(n).
T(n, max(1, 2^(A005811(n)-1))) = A003817(n).

A371263 The run lengths transform of the balanced ternary expansion of n corresponds to the run lengths transform of the binary expansion of a(n).

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 5, 5, 5, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 10, 10, 10, 11, 11, 10, 10, 9, 8, 9, 10, 10, 11, 12, 13, 13, 13, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 18, 18, 18, 19, 20, 21, 21, 22, 23, 22, 21, 21, 20, 20, 21, 21, 21, 20, 21, 22, 22, 23, 23, 22
Offset: 0

Views

Author

Rémy Sigrist, Mar 16 2024

Keywords

Comments

For any v > 0, the value v appears A225081(v-1) times in the sequence.

Examples

			The first terms, alongside the balanced ternary expansion of n and the binary expansion of a(n), are:
  n   a(n)  bter(n)  bin(a(n))
  --  ----  -------  ---------
   0     0        0          0
   1     1        1          1
   2     2       1T         10
   3     2       10         10
   4     3       11         11
   5     4      1TT        100
   6     5      1T0        101
   7     5      1T1        101
   8     5      10T        101
   9     4      100        100
  10     5      101        101
  11     6      11T        110
  12     6      110        110
  13     7      111        111
  14     8     1TTT       1000
  15     9     1TT0       1001
		

Crossrefs

See A371256 for a similar sequence.

Programs

  • PARI
    a(n) = { my (r = [], d, l, v = 0); while (n, d = centerlift(Mod(n, 3)); l = 0; while (centerlift(Mod(n, 3))==d, n = (n-d)/3; l++;); r = concat(l, r);); for (k = 1, #r, v = (v+k%2)*2^r[k]-k%2); v }

Formula

abs(a(n+1) - a(n)) <= 1.

A371265 Irregular triangle T(n, k), n >= 0, read by rows; the n-th row lists the numbers m such that A371263(m) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 9, 6, 7, 8, 10, 11, 12, 13, 14, 27, 15, 16, 26, 28, 17, 19, 20, 21, 24, 25, 29, 30, 18, 22, 23, 31, 32, 36, 33, 34, 35, 37, 38, 39, 40, 41, 81, 42, 43, 80, 82, 44, 46, 47, 48, 78, 79, 83, 84, 45, 49, 77, 85, 50, 58, 59, 63, 72, 76, 86, 90
Offset: 0

Views

Author

Rémy Sigrist, Mar 16 2024

Keywords

Comments

Row 0 has 1 term; for n > 0, row n has A225081(n-1) terms.
As a flat sequence, this is a permutation of the nonnegative integers, with inverse A371266.

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  ------------------------------
   0  0
   1  1
   2  2, 3
   3  4
   4  5, 9
   5  6, 7, 8, 10
   6  11, 12
   7  13
   8  14, 27
   9  15, 16, 26, 28
  10  17, 19, 20, 21, 24, 25, 29, 30
  11  18, 22, 23, 31
  12  32, 36
  13  33, 34, 35, 37
  14  38, 39
  15  40
.
Triangle T(n, k) begins, in balanced ternary, with row indexes in binary:
  bin(n)  n-th row in balanced ternary
  ------  ----------------------------------------------
       0  0
       1  1
      10  1T, 10
      11  11
     100  1TT, 100
     101  1T0, 1T1, 10T, 101
     110  11T, 110
     111  111
    1000  1TTT, 1000
    1001  1TT0, 1TT1, 100T, 1001
    1010  1T0T, 1T01, 1T1T, 1T10, 10T0, 10T1, 101T, 1010
    1011  1T00, 1T11, 10TT, 1011
    1100  11TT, 1100
    1101  11T0, 11T1, 110T, 1101
    1110  111T, 1110
    1111  1111
		

Crossrefs

See A371257 for a similar sequence.
Cf. A225081, A371266 (inverse).

Programs

  • PARI
    \\ See Links section.
Showing 1-4 of 4 results.