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 51-54 of 54 results.

A346310 Positions of words in A076478 such that #0's - #1's is even.

Original entry on oeis.org

3, 4, 5, 6, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106
Offset: 1

Views

Author

Clark Kimberling, Aug 28 2021

Keywords

Examples

			The first fourteen words w(n) are 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, so that a(1) = 3.
		

Crossrefs

Cf. A007931, A076478, A346309 (complement), A053738.

Programs

Formula

a(n) = A053738(n+1) - 1, conjectured.

A380788 Numbers with a prime number of binary digits.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106
Offset: 1

Views

Author

Michael S. Branicky, Feb 03 2025

Keywords

Examples

			4 is a term since its binary representation has 3 bits, a prime.
64 is a term since its binary representation has 7 bits, a prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[200], PrimeQ[BitLength[#]] &] (* Paolo Xausa, Feb 03 2025 *)
  • Python
    from sympy import isprime
    def ok(n): return isprime(n.bit_length())
    print([k for k in range(150) if ok(k)])
    
  • Python
    # faster for initial segment of sequence
    from itertools import islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        d = 2
        while True:
            yield from (i for i in range(2**(d-1), 2**d))
            d = nextprime(d)
    print(list(islice(agen(), 65)))
    
  • Python
    from sympy import primerange
    def A380788(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(min(x,(1<Chai Wah Wu, Feb 03 2025

A079112 Numbers in binary representation with odd length.

Original entry on oeis.org

0, 1, 100, 101, 110, 111, 10000, 10001, 10010, 10011, 10100, 10101, 10110, 10111, 11000, 11001, 11010, 11011, 11100, 11101, 11110, 11111, 1000000, 1000001, 1000010, 1000011, 1000100, 1000101, 1000110, 1000111, 1001000, 1001001
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 25 2002

Keywords

Comments

a(n) = A007088(A053738(n)).

Programs

  • Mathematica
    Join[{0},Select[FromDigits/@Tuples[{0,1},7],OddQ[IntegerLength[#]]&]] (* Harvey P. Dale, Sep 04 2021 *)

A333470 Lexicographically earliest sequence of distinct positive terms such that a(n) is the number of commas that a(n) has to step over (to the right) to be met by an odd term. This odd term might not be the closest odd term to a(n).

Original entry on oeis.org

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

Views

Author

Eric Angelini and Carole Dubois, Mar 23 2020

Keywords

Examples

			a(1) = 1 steps over 1 comma to be met by the odd term 3;
a(2) = 3 steps over 3 commas to be met by the odd term 5;
a(3) = 2 steps over 2 commas to be met by the same odd term 5;
a(4) = 4 steps over 4 commas to be met by the odd term 9 (the odd term 5 is closer, but this is not the point);
a(5) = 5 steps over 5 commas to be met by the odd term 11 (again, the odd terms 7 and 9 are closer, but we don't care); etc.
		

Programs

  • Python
    def a(n): return n if len(bin(n))%2 else n-1 if n%2 else n+1 # Dominic McCarty, Mar 12 2025

Formula

a(n) = n for n in A053738. Otherwise, a(n) = n+1 for even n and a(n) = n-1 for odd n. - Dominic McCarty, Mar 12 2025
Previous Showing 51-54 of 54 results.