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 21-27 of 27 results.

A319408 a(n) = A319407(n)/2.

Original entry on oeis.org

1, 5, 2, 10, 23, 11, 4, 20, 45, 97, 46, 22, 51, 23, 8, 40, 89, 189, 90, 194, 399, 195, 92, 44, 101, 217, 102, 46, 107, 47, 16, 80, 177, 373, 178, 378, 775, 379, 180, 388, 797, 1617, 798, 390, 803, 391, 184, 88, 201, 429, 202, 434, 895, 435, 204, 92, 213, 457, 214, 94, 219, 95, 32, 160, 353, 741, 354, 746, 1527, 747
Offset: 1

Views

Author

N. J. A. Sloane, Sep 19 2018

Keywords

Crossrefs

A319409 a(n) = n - A318921(n).

Original entry on oeis.org

0, 1, 2, 2, 4, 5, 5, 4, 8, 9, 10, 10, 10, 12, 11, 8, 16, 17, 18, 18, 20, 21, 21, 20, 20, 23, 25, 24, 22, 26, 23, 16, 32, 33, 34, 34, 36, 37, 37, 36, 40, 41, 42, 42, 42, 44, 43, 40, 40, 45, 48, 46, 50, 52, 51, 48, 44, 51, 55, 52, 46, 54, 47, 32, 64, 65, 66, 66, 68, 69, 69, 68, 72, 73, 74, 74, 74, 76, 75, 72, 80, 81, 82, 82, 84, 85, 85, 84, 84, 87, 89, 88, 86, 90, 87, 80, 80
Offset: 0

Views

Author

N. J. A. Sloane, Sep 19 2018

Keywords

Comments

How much n decreases by when its binary runs are all shortened by one bit.

Crossrefs

Programs

  • PARI
    a(n) = my (p=-1, d=0, b=1, r=n); while (r, my (l=r%2); if (p!=l, p=l, d+=l*b; b*=2); r\=2); n-d \\ Rémy Sigrist, Sep 25 2018

Formula

a(n) = n iff n is a Fibbinary number (A003714). - Rémy Sigrist, Sep 25 2018

A320262 Write n in binary, then modify each run of 0's and each run of 1's by appending a 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

2, 8, 6, 16, 34, 24, 14, 32, 66, 136, 70, 48, 98, 56, 30, 64, 130, 264, 134, 272, 546, 280, 142, 96, 194, 392, 198, 112, 226, 120, 62, 128, 258, 520, 262, 528, 1058, 536, 270, 544, 1090, 2184, 1094, 560, 1122, 568, 286, 192, 386, 776, 390, 784, 1570, 792, 398
Offset: 1

Views

Author

Chai Wah Wu, Oct 08 2018

Keywords

Comments

A variation of A175046. Indices of record values are given by A319423.
From Chai Wah Wu, Nov 21 2018: (Start)
Let f(k) = Sum_{i=2^k..2^(k+1)-1} a(i), i.e., the sum ranges over all numbers with a (k+1)-bit binary expansion. Thus f(0) = a(1) = 2 and f(1) = a(2) + a(3) = 14.
Then f(k) = 15*6^(k-1) - 2^(k-1) for k >= 0.
Proof: the equation for f is true for k = 0. Looking at the last 2 bits of n, it is easy to see that a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+2, a(4n+2) = 4*a(2n+1) and a(4n+3) = 2*a(2n+1)+2. By summing over the recurrence relations for a(n), we get f(k+2) = Sum_{i=2^k..2^(k+1)-1} (f(4i) + f(4i+1) + f(4i+2) + f(4i+3)) = Sum_{i=2^k..2^(k+1)-1} (6a(2i) + 6a(2i+1) + 4) = 6*f(k+1) + 2^(k+2). Solving this first-order recurrence relation with the initial condition f(1) = 14 shows that f(k) = 15*6^(k-1) - 2^(k-1) for k > 0.
(End)

Examples

			6 in binary is 110. Modify each run by appending a 0 to get 11000, which is 24 in decimal. So a(6) = 24.
		

Crossrefs

Programs

  • Mathematica
    Array[FromDigits[Flatten@ Map[Append[#, 0] &, Split@ IntegerDigits[#, 2]], 2] &, 55] (* Michael De Vlieger, Nov 23 2018 *)
  • Python
    from re import split
    def A320262(n):
        return int(''.join(d+'0' for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2)

Formula

a(n) = 2*A320263(n).
a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+2, a(4n+2) = 4*a(2n+1) and a(4n+3) = 2*a(2n+1)+2. - Chai Wah Wu, Nov 21 2018

A320263 Write n in binary, then modify each run of 0's and each run of 1's by prepending a 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

1, 4, 3, 8, 17, 12, 7, 16, 33, 68, 35, 24, 49, 28, 15, 32, 65, 132, 67, 136, 273, 140, 71, 48, 97, 196, 99, 56, 113, 60, 31, 64, 129, 260, 131, 264, 529, 268, 135, 272, 545, 1092, 547, 280, 561, 284, 143, 96, 193, 388, 195, 392, 785, 396, 199, 112, 225, 452, 227
Offset: 1

Views

Author

Chai Wah Wu, Oct 08 2018

Keywords

Comments

A variation of A175046. Indices of record values are given by A319423.

Examples

			6 in binary is 110. Modify each run by prepending a 0 to get 01100, which is 12 in decimal. So a(6) = 12.
		

Crossrefs

Programs

  • Python
    from re import split
    def A320263(n):
        return int(''.join('0'+d for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2)

Formula

a(n) = A320262(n)/2.

A321002 a(0)=3; thereafter a(n) = 20*6^(n-1)-2^(n-1).

Original entry on oeis.org

3, 19, 118, 716, 4312, 25904, 155488, 933056, 5598592, 33592064, 201553408, 1209322496, 7255939072, 43535642624, 261213872128, 1567283265536, 9403699658752, 56422198083584, 338533188763648, 2031199133106176, 12187194799685632, 73123168800210944, 438739012805459968, 2632434076841148416
Offset: 0

Views

Author

N. J. A. Sloane, Nov 01 2018

Keywords

Comments

Conjectured to be the sum of A175046(i) for 2^n <= i < 2^(n+1).
Conjecture is true (see comments in A175046). - Chai Wah Wu, Nov 18 2018

Crossrefs

Essentially the first differences of A321003.
Cf. A175046.

Programs

  • PARI
    Vec((1 - x)*(3 - 2*x) / ((1 - 2*x)*(1 - 6*x)) + O(x^25)) \\ Colin Barker, Nov 02 2018
    
  • PARI
    a(n) = if (n, 20*6^(n-1)-2^(n-1), 3); \\ Michel Marcus, Nov 02 2018

Formula

From Colin Barker, Nov 02 2018: (Start)
G.f.: (1 - x)*(3 - 2*x) / ((1 - 2*x)*(1 - 6*x)).
a(n) = 8*a(n-1) - 12*a(n-2) for n>2.
(End)

A319406 Write n-th prime in binary, then increase each run of 0's by one 0, and increase each run of 1's by one 1. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

12, 7, 51, 15, 103, 115, 195, 199, 207, 243, 63, 1587, 1635, 1639, 415, 1843, 487, 499, 775, 783, 3171, 799, 3271, 3299, 899, 3635, 911, 3687, 3699, 963, 255, 1543, 6243, 6247, 25395, 6351, 6387, 6535, 6543, 26227, 6599, 26419, 1663, 1795, 7219, 1807, 7367
Offset: 1

Views

Author

N. J. A. Sloane, Sep 19 2018

Keywords

Comments

Apply A175046 to the primes.

Crossrefs

Cf. A175046.
A companion to A318923.

Programs

  • Python
    from sympy import prime
    def a(n):
        b = bin(prime(n))[2:]
        return int(b.replace("01", "001").replace("10", "110") + b[-1], 2)
    print([a(n) for n in range(1, 48)]) # Michael S. Branicky, Dec 07 2021

Extensions

More terms from Rémy Sigrist, Sep 20 2018

A322404 Square array T(n, k) read by antidiagonals, n >= 0 and k >= 0: the lengths of runs in binary expansion of T(n, k) are obtained by adding those of n and of k (see Comments for precise definition).

Original entry on oeis.org

0, 1, 1, 2, 3, 2, 3, 12, 12, 3, 4, 7, 12, 7, 4, 5, 24, 56, 56, 24, 5, 6, 51, 24, 15, 24, 51, 6, 7, 28, 3276, 112, 112, 3276, 28, 7, 8, 15, 28, 455, 48, 455, 28, 15, 8, 9, 48, 240, 120, 25368, 25368, 120, 240, 48, 9, 10, 99, 48, 31, 56, 51, 56, 31, 48, 99, 10
Offset: 0

Views

Author

Rémy Sigrist, Dec 06 2018

Keywords

Comments

For any n >= 0 and k >= 0:
- let r_n be the lengths of runs in binary expansion of n,
- for n = 0: we assume that r_0 = (0),
- let R_n be the #r_n-periodic sequence whose first #r_n terms match r_n,
- r_{T(n, k)} has lcm(#r_n, #r_k) terms and r_{T(n, k)}(i) = R_n(i) + R_k(i) for i = 1..lcm(#r_n, #r_k).

Examples

			Array T(n, k) begins (in decimal):
  n\k|  0   1     2    3      4       5      6     7       8       9        10
  ---+------------------------------------------------------------------------
    0|  0   1     2    3      4       5      6     7       8       9        10
    1|  1   3    12    7     24      51     28    15      48      99       204
    2|  2  12    12   56     24    3276     28   240      48   12700       204
    3|  3   7    56   15    112     455    120    31     224     903      3640
    4|  4  24    24  112     48   25368     56   480      96   99896       792
    5|  5  51  3276  455  25368      51  29596  3855  199728      99  13421772
    6|  6  28    28  120     56   29596     60   496     112  116540       924
    7|  7  15   240   31    480    3855    496    63     960    7695     61680
    8|  8  48    48  224     96  199728    112   960     192  792688      3120
Array T(n, k) begins (in binary):
   n\k|     0       1            10         11              100
  ----+--------------------------------------------------------
     0|     0       1            10         11              100
     1|     1      11          1100        111            11000
    10|    10    1100          1100     111000            11000
    11|    11     111        111000       1111          1110000
   100|   100   11000         11000    1110000           110000
   101|   101  110011  110011001100  111000111  110001100011000
   110|   110   11100         11100    1111000           111000
   111|   111    1111      11110000      11111        111100000
  1000|  1000  110000        110000   11100000          1100000
		

Crossrefs

See A322403 for the multiplicative variant.

Programs

  • PARI
    T(n,k) = my (v=0, p=1, rn=n, rk=k, b=if ((max(n,1)%2)&&(max(k,1)%2), 1, 0)); while (1, my (vn=if (rn==0, 0, valuation(rn+(rn%2), 2)), vk=if(rk==0, 0, valuation(rk+(rk%2), 2)), w=vn+vk); v+=b*p*(2^w-1); rn\=2^vn; rk\=2^vk; if (rn==0 && rk==0, return (v), rn==0, rn=n, rk==0, rk=k); p*=2^w; b=1-b)

Formula

For any m >= 0, n >= 0 and k >= 0:
- T(n, k) = T(k, n) (T is commutative),
- T(m, T(n, k)) = T(T(m, n), k) (T is associative),
- T(n, 0) = n (0 is a neutral element for T),
- T(n, 1) = A175046(n),
- T(n, n) = A001196(n),
- A005811(T(n, k)) = max(A005811(n), A005811(k), lcm(A005811(n), A005811(k))),
- T(2^n - 1, 2^k - 1) = 2^(n+k) - 1,
- T(2^n, 2^k) = 3 * 2^(n+k) when n > 0 and k > 0,
- T(n, k) is odd iff both n and k are odd.
Previous Showing 21-27 of 27 results.