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.

A292204 Primes as they appear in A006068.

Original entry on oeis.org

3, 2, 7, 5, 13, 11, 31, 29, 17, 19, 23, 61, 59, 53, 37, 47, 41, 43, 127, 113, 97, 103, 101, 109, 107, 67, 71, 79, 73, 89, 83, 251, 241, 227, 229, 239, 233, 193, 199, 197, 223, 211, 131, 137, 139, 157, 151, 149, 191, 179, 181, 163, 167, 173, 509, 499, 503, 487, 491, 449, 463, 461
Offset: 1

Views

Author

Robert G. Wilson v, Sep 11 2017

Keywords

Comments

a(n) is the i-th prime (as it appears in A000040) for i = 2, 1, 4, 3, 6, 5, 9, 10, 11, 8, 7, 15, 17, 18, 16, 14, etc.

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor @@ Table[ Floor[n/2^m], {m, 0, Floor[Log2@ n]}]; Select[ Array[f, 300], PrimeQ]
  • PARI
    grayinto(n) = my(B=n); for(k=1, log(n+1)\log(2), B=bitxor(B, n\2^k)); B;
    lista(nn) = for (n=1, nn, if (isprime(p=grayinto(n)), print1(p, ", "))); \\ Michel Marcus, Oct 10 2017
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A292204_gen(): # generator of terms
        for n in count(0):
            k, m = n, n>>1
            while m > 0:
                k ^= m
                m >>= 1
            if isprime(k):
                yield k
    A292204_list = list(islice(A292204_gen(),30)) # Chai Wah Wu, Jun 29 2022

A292205 A sequence of primes beginning with 2, with each prime after that being the smallest prime not present differing by the least number of contiguous bits.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 29, 31, 23, 19, 17, 37, 53, 61, 59, 43, 41, 47, 79, 71, 67, 83, 107, 103, 101, 97, 113, 73, 89, 179, 163, 131, 139, 137, 233, 229, 197, 193, 199, 167, 151, 149, 157, 173, 109, 397, 269, 271, 263, 257
Offset: 1

Views

Author

Robert G. Wilson v, Sep 11 2017

Keywords

Comments

Least prime not already present, formed from the previous prime by first flipping or inverting a single binary bit and if no such prime exists, then two contiguous bits, then three, etc., and if no such prime exists then by inserting increasing binary bits starting with "0", "1", "00", "01", "10", "11", etc. resulting in the least prime so created. Leading zeros are forbidden.
Inspired by A059459.

Examples

			a(1) =  2 =     10_2, by definition, there are no single binary digit primes and this is the least 2-bit prime;
a(2) =  3 =     11_2, the least significant bit was "flipped"; all 2-bit primes are now present;
a(3) =  5 =    101_2, since the next prime is formed by inserting a 0;
a(4) =  7 =    111_2, since it is obtained by "flipping" the twos bit; all 3-bit primes are now present;
a(5) = 11 =   1011_2, since it is the least prime formed by inserting a 0;
a(6) = 13 =   1101_2, since it is the least prime formed by flipping two contiguous bits; all 4-bit primes are now present;
a(7) = 29 =  11101_2, since it is the least prime formed by inserting a 1; no prime is generated by the insertion of a 0, i.e.; from 1101 (13_10) -> 10101 (21_10) or 11001 (25_10);
a(8) = 31 =  11111_2, since it is the least prime formed by flipping the twos bit;
a(9) = 23 =  10111_2, since it is the least prime formed by flipping one bits;
a(10) = 19 =  10011_2; flip 1 digit;
a(11) = 17 =  10001_2; flip 1 digit, all 5-bit primes are now present;
a(12) = 37 = 100101_2; insert the single digit 1, inserting the single digit 0 yields the composite 100001_2 = 33.
a(13) = 53 = 110101_2; flip a single digit; etc.
		

Crossrefs

Showing 1-2 of 2 results.