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 24 results. Next

A255066 The trunk of number-of-runs beanstalk (A255056) with reversed subsections.

Original entry on oeis.org

0, 2, 6, 4, 14, 12, 10, 30, 28, 26, 22, 18, 62, 60, 58, 54, 50, 46, 42, 36, 32, 126, 124, 122, 118, 114, 110, 106, 100, 96, 94, 90, 84, 78, 74, 68, 64, 254, 252, 250, 246, 242, 238, 234, 228, 224, 222, 218, 212, 206, 202, 196, 192, 190, 186, 180, 174, 168, 162, 156, 152, 148, 142, 138, 132, 128, 510
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Comments

This can be viewed as an irregular table: after the initial zero on row 0, start each row n with term x = (2^(n+1))-2 and subtract repeatedly the number of runs in binary representation of x to get successive x's, until the number that has already been listed (which is always (2^n)-2) is encountered, which is not listed second time, but instead, the current row is finished [and thus containing only terms of equal binary length, A000523(n) on row n]. The next row then starts with (2^(n+2))-2, with the same process repeated.

Examples

			Rows 0 - 5 of the array:
0;
2;
6, 4;
14, 12, 10;
30, 28, 26, 22, 18;
62, 60, 58, 54, 50, 46, 42, 36, 32;
After row 0, the length of row n is given by A255071(n).
		

Crossrefs

Cf. A255067 (same seq, terms divided by 2).
Cf. A255071 (gives row lengths).
Analogous sequences: A218616, A230416.

Formula

a(0) = 0, a(1) = 2, a(2) = 6; and for n > 2, a(n) = A004755(A004755(A236840(a(n-1)))) if A236840(a(n-1))+2 is power of 2, otherwise just A236840(a(n-1)) [where A004755(x) adds one 1-bit to the left of the most significant bit of x].
In other words, for n > 2, let k = A236840(a(n-1)). Then, if k+2 is not a power of 2, a(n) = k, otherwise a(n) = k + (6 * (2^A000523(k))).
Other identities. For all n >= 0:
a(n) = A255056(A255122(n)).

A175930 Concatenation of run lengths in binary expansion of n, written in base 2, then converted to base 10.

Original entry on oeis.org

1, 3, 2, 6, 7, 5, 3, 7, 13, 15, 14, 10, 11, 7, 4, 12, 15, 27, 26, 30, 31, 29, 15, 11, 21, 23, 22, 14, 15, 9, 5, 13, 25, 31, 30, 54, 55, 53, 27, 31, 61, 63, 62, 58, 59, 31, 28, 20, 23, 43, 42, 46, 47, 45, 23, 15, 29, 31, 30, 18, 19, 11, 6, 14, 27, 51, 50, 62, 63, 61, 31, 55, 109, 111
Offset: 1

Views

Author

Dylan Hamilton, Oct 23 2010

Keywords

Examples

			6 = 110, two runs, lengths 2 and 1, so we write down 101 and convert it to base 10, getting 5. So a(6) = 5.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[Flatten[IntegerDigits[Length /@ Split[IntegerDigits[n, \ 2]], 2]], 2]
    Array[f, NUMBER OF TERMS]
  • PARI
    a(n) = my (b=[]); while (n, my (x=valuation(n+(n%2), 2)); b = concat(binary(x), b); n \= 2^x); fromdigits(b, 2) \\ Rémy Sigrist, Jul 02 2019
    
  • Python
    from itertools import groupby
    def a(n):
        c = "".join(bin(len(list(g)))[2:] for k, g in groupby(bin(n)[2:]))
        return int(c, 2)
    print([a(n) for n in range(1, 75)]) # Michael S. Branicky, Oct 02 2021

Formula

From Rémy Sigrist, Jul 02 2019: (Start)
a(2^k-1) = k for any k > 0.
a(2^k) = A004755(k) for any k > 0. (End)

Extensions

Edited by N. J. A. Sloane, Oct 23 2010

A206332 Complement of A092754.

Original entry on oeis.org

2, 5, 6, 11, 12, 13, 14, 23, 24, 25, 26, 27, 28, 29, 30, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2012

Keywords

Comments

Conjecture: these are the positions words in A076478 that start with 0 and end with 1. - Clark Kimberling, Jul 14 2021

Crossrefs

Cf. A004755, A004760, A092754 (complement).

Programs

  • Haskell
    a206332 n = a206332_list !! (n-1)
    a206332_list = compl [1..] a092754_list where
       compl (u:us) vs'@(v:vs) | u == v = compl us vs
                               | u /= v = u : compl us vs'
    
  • PARI
    a(n) = n + 2<Kevin Ryde, Jun 19 2021

Formula

a(n) = A004760(n+2) - 1. - Rémy Sigrist, May 05 2019
a(n) = A004755(n) - 1. - Kevin Ryde, Jun 19 2021

A218614 a(n) = binary code (shown here in decimal) of the position of natural number n in the beanstalk-tree A218778.

Original entry on oeis.org

1, 2, 3, 5, 7, 9, 13, 21, 29, 37, 53, 69, 101, 85, 117, 181, 245, 309, 437, 565, 821, 693, 949, 1205, 1717, 1461, 1973, 2741, 3765, 2485, 3509, 5557, 7605, 9653, 13749, 17845, 26037, 21941, 30133, 38325, 54709, 46517, 62901, 87477, 120245, 79285, 112053, 144821
Offset: 1

Views

Author

Antti Karttunen, Nov 16 2012

Keywords

Comments

The binary code is the same as used by function general-car-cdr of MIT/GNU Scheme: a zero bit represents a cdr operation (taking the right hand side branch in the binary tree), and a one bit represents a car (taking the left hand side branch in the binary tree). The bits are interpreted from LSB to MSB, and the most significant one bit, rather than being interpreted as an operation, signals the end of the binary code.

Examples

			As we must traverse to 4 in A218778-tree (see the example there) by first taking the left branch (car) from the root, resulting bit 1 as the least significant bit of the code, then by taking the right branch (cdr) from 3 to get to 4, resulting bit 0 as the second rightmost bit of the code, which when capped with an extra termination-one, results binary code 101, 5 in decimal, thus a(4)=5.
		

Crossrefs

a(n) = A054429(A218615(n)). Superset of A218790. Used to construct A218778, A218779. Cf. also A218787, A218788

Formula

a(1)=1; for even n, a(n) = A004754(a(A011371(n))); for odd n, a(n) = A004755(a(A011371(n))).

A218615 a(n) = binary code (shown here in decimal) of the position of natural number n in the beanstalk-tree A218776.

Original entry on oeis.org

1, 3, 2, 6, 4, 14, 10, 26, 18, 58, 42, 122, 90, 106, 74, 202, 138, 458, 330, 970, 714, 842, 586, 1866, 1354, 1610, 1098, 3402, 2378, 3658, 2634, 6730, 4682, 14922, 10826, 31306, 23114, 27210, 19018, 59978, 43594, 51786, 35402, 109130, 76362, 117322, 84554, 248394
Offset: 1

Views

Author

Antti Karttunen, Nov 16 2012

Keywords

Comments

The binary code is the same as used by function general-car-cdr of MIT/GNU Scheme: a zero bit represents a cdr operation (taking the right hand side branch in the binary tree), and a one bit represents a car (taking the left hand side branch in the binary tree). The bits are interpreted from LSB to MSB, and the most significant one bit, rather than being interpreted as an operation, signals the end of the binary code.

Examples

			As we can traverse to 4 in A218776-tree (see the example there) by taking first the right branch (cdr) from the root, resulting bit 0 as the least significant bit of the code, then by taking the left branch (car) from 3 to get to 4, resulting bit 1 as the second rightmost bit of the code, which when capped with an extra termination-one, results binary code 110, 6 in decimal, thus a(4)=6.
		

Crossrefs

a(n) = A054429(A218614(n)). Superset of A218791. Used to construct A218776, A218777. Cf. also A179016, A218787, A218788

Formula

a(1)=1, for odd n, a(n) = A004754(a(A011371(n))), for even n, a(n) = A004755(a(A011371(n))).

A218790 a(n) = binary code (shown here in decimal) of the position of the predecessor of the natural number pair (2n,2n+1) in the compact beanstalk-tree A218782.

Original entry on oeis.org

1, 3, 5, 13, 21, 37, 53, 117, 181, 309, 437, 693, 949, 1717, 1461, 3509, 5557, 9653, 13749, 21941, 30133, 54709, 46517, 79285, 112053, 210357, 177589, 472501, 308661, 734645, 996789, 2045365, 3093941, 5191093, 7288245, 11482549, 15676853, 28259765, 24065461
Offset: 1

Views

Author

Antti Karttunen, Nov 16 2012

Keywords

Crossrefs

Subset of A218614, i.e. a(n) = A218614(A005187(n)).
Also, a(n) = A054429(A218791(n)). Used to construct A218782, A218783. Cf. also A218787, A218788

Formula

a(n) = A218614(A005187(n)).

A218791 a(n) = binary code (shown here in decimal) of the position of the predecessor of the natural number pair (2n,2n+1) in the compact beanstalk-tree A218780.

Original entry on oeis.org

1, 2, 6, 10, 26, 58, 42, 74, 202, 458, 330, 842, 586, 1354, 1610, 2634, 6730, 14922, 10826, 27210, 19018, 43594, 51786, 117322, 84554, 182858, 215626, 313930, 477770, 838218, 576074, 1100362, 3197514, 7391818, 5294666, 13683274, 9488970, 22071882, 26266186
Offset: 1

Views

Author

Antti Karttunen, Nov 16 2012

Keywords

Crossrefs

Subset of A218615, i.e., a(n) = A218615(A005187(n)).
Also, a(n) = A054429(A218790(n)). (Note also how the first five or so terms are twice the terms in the beginning of A218790, shifted by one term.)
Used to construct A218780, A218781. Cf. also A218787, A218788.

Formula

a(n) = A218615(A005187(n)).

A065047 Primes which when written in base 2 and prepended with a 1 produce a prime.

Original entry on oeis.org

3, 5, 13, 29, 37, 43, 71, 83, 101, 113, 163, 193, 211, 223, 257, 311, 317, 347, 479, 509, 547, 577, 613, 643, 673, 709, 787, 823, 853, 877, 883, 907, 1031, 1061, 1181, 1223, 1259, 1283, 1409, 1451, 1481, 1493, 1499, 1511, 1523, 1559, 1583, 1721, 1871, 1973
Offset: 1

Views

Author

Robert G. Wilson v, Nov 05 2001

Keywords

Comments

Primes p such that p and 2^k + p (where k is the smallest power of 2 such that 2^k > p) are primes. - Davide Rotondo, Nov 06 2024

Examples

			13 is in the sequence because 13_10 = 1101_2 and prepending a 1 gives 11101_2 = 29_10, which is a prime.
		

Crossrefs

Programs

  • Mathematica
    Do[p = Prime[n]; d = IntegerDigits[p, 2]; If[ PrimeQ[ FromDigits[ Prepend[d, 1], 2]], Print[p]], {n, 1, 350} ]
    Select[Prime[Range[300]],PrimeQ[FromDigits[Join[{1},IntegerDigits[#,2]],2]]&] (* Harvey P. Dale, Apr 10 2023 *)
  • PARI
    { n=0; t=log(2); for (m=1, 10^9, p=prime(m); if (isprime(p + 2^(1 + log(p)\t)), write("b065047.txt", n++, " ", p); if (n==1000, return)) ) } \\ Harry J. Smith, Oct 05 2009

A080565 Binary expansion of n has form 11**...*1.

Original entry on oeis.org

3, 7, 13, 15, 25, 27, 29, 31, 49, 51, 53, 55, 57, 59, 61, 63, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233
Offset: 1

Views

Author

Benoit Cloitre, Feb 22 2003

Keywords

Comments

If n>3 is in the sequence so are 2n-1 and 2n+1.

Crossrefs

A004755 = union of A079946 and this sequence.
A diagonal of A246830.

Formula

a(n) = 2^floor(log[2](4*(n-1)))+2*n-1 for n>1, a(1)=3. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 22 2003
Equals 2 * A004760(n) + 1. - Ralf Stephan, Sep 16 2003

A294991 Let S be the sequence of integer sets defined by the following rules: S(0) = {0}, S(1) = {1} and for any k > 0, S(2*k) = {2*k} U S(k) and S(2*k+1) = {2*k+1} U S(k) U S(k+1) (where X U Y denotes the union of the sets X and Y); a(n) = the number of elements of S(n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Nov 12 2017

Keywords

Comments

For any n >= 0, a(n) corresponds the number of calls to the "fusc" function (defined by Dijkstra) required to compute A002487(n) with an implementation using memoization, and starting with an empty cache.
The sequence A215673 corresponds to the variant without memoization.
For any n > 0, a(n) <= A215673(n) (with equality iff n is a power of 2).
The scatterplot of the ordinal transform of the sequence shows a network of broken lines.
Also: for n >= 1, a(n)+2 is the number of states in the minimal complete deterministic finite automaton that accepts the base-2 representation of m and m+n in parallel, starting with the most significant digit. - Jeffrey Shallit, Jul 22 2023

Examples

			The first terms, alongside the corresponding set S(n), are:
n   a(n)    S(n)
--  ----    -----
0   1       { 0 }
1   1       { 1 }
2   2       { 1, 2 }
3   3       { 1, 2, 3 }
4   3       { 1, 2, 4 }
5   4       { 1, 2, 3, 5 }
6   4       { 1, 2, 3, 6 }
7   5       { 1, 2, 3, 4, 7 }
8   4       { 1, 2, 4, 8 }
9   6       { 1, 2, 3, 4, 5, 9 }
10  5       { 1, 2, 3, 5, 10 }
11  6       { 1, 2, 3, 5, 6, 11 }
12  5       { 1, 2, 3, 6, 12 }
13  7       { 1, 2, 3, 4, 6, 7, 13 }
14  6       { 1, 2, 3, 4, 7, 14 }
15  7       { 1, 2, 3, 4, 7, 8, 15 }
16  5       { 1, 2, 4, 8, 16 }
17  8       { 1, 2, 3, 4, 5, 8, 9, 17 }
18  7       { 1, 2, 3, 4, 5, 9, 18 }
19  8       { 1, 2, 3, 4, 5, 9, 10, 19 }
20  6       { 1, 2, 3, 5, 10, 20 }
See also illustration of the first terms in Links section.
		

Crossrefs

Programs

  • PARI
    a(n) = my (S = Set(n), u = 1); while (u <= #S, my (v = S[#S-u+1]); if (v>1, if (v%2==0, S = setunion(S, Set(v/2)), S = setunion(S, Set([(v-1)/2, (v+1)/2])))); u++;); return (#S)

Formula

a(n) = 2*floor(log_2 n) - nu_2(n) + [n is a power of 2] + [1st two bits of n in base 2 are 11] = 2*A000523(n) - A007814(n) + A209229(n) + [n belongs to A004755], for n >= 1. - Jeffrey Shallit, Jul 20 2023
a(2*n) = a(n) + 1, n >= 1.
a(4*n+1) = a(2*n+1)+2, n >= 2.
a(4*n+3) = a(2*n+1)+2, n >= 0.
a(2^k) = k + 1 for any k >= 0.
Empirically: a(2*k-1) = 2*A070939(k) - 2*A209229(k) + [(k-1) is in A004760] for any k > 0 (where [P]=1 if P is true and [P]=0 otherwise).
Previous Showing 11-20 of 24 results. Next