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.

A096235 Number of n-bit base-2 deletable primes.

Original entry on oeis.org

0, 2, 2, 2, 3, 6, 6, 11, 18, 31, 49, 87, 155, 253, 427, 781, 1473, 2703, 5094, 9592, 18376, 35100, 67183, 129119, 249489, 482224, 930633, 1803598, 3502353, 6813094, 13271996, 25892906, 50583039, 98948426, 193629933, 379398057, 744508765, 1461801309
Offset: 1

Views

Author

Michael Kleber, Feb 28 2003

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. However, in base 2 we adopt the convention that 2 = 10 and 3 = 11 are deletable.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Examples

			d base-2 d-digit deletable primes
2 2=10, 3=11
3 5=101, 7=111
4 11=1011, 13=1101
5 19=10011, 23=10111, 29=11101
6 37=100101, 43=101011, 47=101111, 53=110101, 59=111011, 61=111101
7 73=1001001, 79=1001111, 83=1010011, 101=1100101, 107=1101011, 109=1101101
		

Crossrefs

Programs

  • Mathematica
    a = {0, 2}; d = {2, 3};
    For[n = 3, n <= 15, n++,
    p = Select[Range[2^(n - 1), 2^n - 1], PrimeQ[#] &];
    ct = 0;
    For[i = 1, i <= Length[p], i++,
      c = IntegerDigits[p[[i]], 2];
      For[j = 1, j <= n, j++,
       t = Delete[c, j];
       If[t[[1]] == 0, Continue[]];
       If[MemberQ[d, FromDigits[t, 2]], AppendTo[d, p[[i]]]; ct++;
         Break[]]]];
    AppendTo[a, ct]];
    a (* Robert Price, Nov 11 2018 *)
  • Python
    from sympy import isprime
    def ok(n, prevset):
        if not isprime(n): return False
        b = bin(n)[2:]
        bi = (b[:i]+b[i+1:] for i in range(len(b)))
        return any(t[0] != '0' and int(t, 2) in prevset for t in bi)
    def afind(terms):
        s, snxt = {2, 3}, set()
        print("0,", len(s), end=", ")
        for n in range(3, terms+1):
            for i in range(2**(n-1), 2**n):
                if ok(i, s):
                    snxt.add(i)
            s, snxt = snxt, set()
            print(len(s), end=", ")
    afind(20) # Michael S. Branicky, Jan 14 2022

Extensions

a(19)-a(30) from Ryan Propper, Jul 18 2005
a(31)-a(33) from Michael S. Branicky, Jan 14 2022
a(34)-a(37) from Michael S. Branicky, May 30 2025
a(38) from Michael S. Branicky, Jun 02 2025

A101216 Number of n-digit base-2 deletable digit-sum multiple (DSM) integers.

Original entry on oeis.org

1, 1, 2, 3, 5, 6, 9, 13, 26, 44, 87, 165, 305, 523, 948, 1792, 3501, 6644, 12622, 23334, 43232, 79651, 149716, 281278, 532051, 1000247, 1883093, 3577619, 6901273, 13495425, 26522993, 51976835
Offset: 1

Views

Author

John W. Layman, Dec 14 2004

Keywords

Comments

A positive integer n is a base-b digit-sum-multiple (DSM) number if the sum of the digits of n, in base b, divides n. It is a deletable base-b DSM if it has the property that removing some digit leaves either the empty string or another deletable base-b DSM.

Crossrefs

Cf. A096236.

Programs

  • Python
    from itertools import count, islice
    def ok(n, prevset):
        b = bin(n)[2:]
        if n%b.count("1"): return False
        si = (b[:i]+b[i+1:] for i in range(len(b)))
        return any(t[0] != '0' and int(t, 2) in prevset for t in si)
    def agen(): # generator of terms
        s, snxt = {1}, set()
        for n in count(2):
            yield len(s)
            for i in range(2**(n-1), 2**n):
                if ok(i, s):
                    snxt.add(i)
            s, snxt = snxt, set()
    print(list(islice(agen(), 20))) # Michael S. Branicky, Feb 25 2023

Extensions

a(19)-a(32) from Michael S. Branicky, Feb 25 2023
Showing 1-2 of 2 results.