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-3 of 3 results.

A296806 Take a prime, convert it to base 2, remove its most significant digit and its least significant digit and convert it back to base 10. Sequence lists primes that generate another prime by this process.

Original entry on oeis.org

13, 23, 31, 37, 43, 47, 59, 71, 79, 103, 127, 139, 151, 163, 167, 191, 211, 223, 251, 263, 271, 283, 331, 379, 463, 523, 547, 571, 587, 599, 607, 619, 631, 647, 659, 691, 719, 727, 739, 787, 811, 827, 839, 859, 907, 911, 967, 971, 991, 1031, 1039, 1051, 1063, 1087
Offset: 1

Views

Author

Paolo P. Lava, Paolo Iachia, Dec 21 2017

Keywords

Comments

From an idea of Ken Abbott (see link).
From Paolo Iachia, Dec 21 2017: (Start)
Let us call these numbers "core of a prime".
Let C(q) be the core of a prime q.
Then C(q) = (q - 2^floor(log_2(q)) - 1)/2.
Examples: C(59) = (59 - 2^5 - 1)/2 = 13; C(71) = (71 - 2^6 - 1)/2 = 3; C(73) = (73 - 2^6 - 1)/2 = 4; C(251) = (251 - 2^7 - 1)/2 = 61.
0 <= C(q) <= 2^(floor(log_2(q)) - 1) - 1. The minimum (0) occurs when q = 2^n+1, with n > 2. Example: 17 = 2^4+1, C(17) = (17 - 2^4 - 1)/2 = 0. The maximum is reached when q = 2^n-1 is a Mersenne prime. Example: 127 = 2^7 - 1, C(127) = (127 - 2^6 - 1)/2 = 31 = 2^5 - 1.
The last example is particularly interesting, as both the prime q and its core are Mersenne primes. The same holds for C(31) = 7 and for C(524247) = 131071, with 524247 = 2^19-1 and 131071 = 2^17-1, both Mersenne primes. Are there more such cases?
Note that the core of Mersenne number (prime or not) is a Mersenne number by definition. Counterexamples include C(8191) = 2047, with 8191 = 2^13 - 1, a Mersenne prime, but 2047 = 2^11 - 1 = 23*89, a Mersenne number not prime, and C(131071) = 32767 = 2^15 - 1 = 7*31*151, with 2 of its factors being Mersenne primes.
Primes whose binary expansion is of the form q = 1 0 ... 0 c_1 c_2 ... c_k 1 - with none or any number of consecutive 0's and with binary core c_1 c_2 ... c_k, k >= 0 - share the same core value. Let p = C(q), then we can write, in decimal form, q = (2p+1) + 2^n, for an appropriate n. While the property is true for p prime, it can be generalized to any positive integer.
Conjecture: for any positive integer p, there are infinitely many primes q for which there exists an integer n such that q-(2p+1) = 2^n. (End)

Examples

			13 in base 2 is 1101 and 10 is 2;
23 in base 2 is 10111 and 011 is 3;
31 in base 2 is 11111 and 111 is 7.
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(q) local a,b,c,j,n,ok,x;  x:=5; for n from x to q do ok:=1; a:=convert(ithprime(n),base,2); b:=nops(a)-1; while a[b]=0 do b:=b-1; od; c:=0;
    for j from b by -1 to 2 do c:=2*c+a[j]; od;if isprime(c) then x:=n; print(ithprime(n)); fi; od; end: P(10^6);
    # simpler alternative:
    select(t -> isprime(t) and isprime((t - 2^ilog2(t) - 1)/2), [seq(i,i=3..10^4,2)]); # Robert Israel, Dec 28 2017
  • Mathematica
    Select[Prime[Range[200]],PrimeQ[FromDigits[Most[Rest[IntegerDigits[ #,2]]],2]]&] (* Harvey P. Dale, Jul 19 2020 *)
  • PARI
    lista(nn) = forprime(p=13, nn, if(isprime((p - 2^logint(p, 2) - 1)/2), print1(p, ", "))) \\ Iain Fox, Dec 28 2017
    
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        p = 7
        while True:
            if isprime(int(bin(p)[3:-1], 2)):
                yield p
            p = nextprime(p)
    print(list(islice(agen(), 54))) # Michael S. Branicky, May 16 2022

Formula

Primes q such that C(q) = (q - 2^floor(log_2(q)) - 1)/2 is prime too.

A297928 a(n) = 2*4^n + 3*2^n - 1.

Original entry on oeis.org

4, 13, 43, 151, 559, 2143, 8383, 33151, 131839, 525823, 2100223, 8394751, 33566719, 134242303, 536920063, 2147581951, 8590131199, 34360131583, 137439739903, 549757386751, 2199026401279, 8796099313663, 35184384671743, 140737513521151, 562950003752959, 2251799914348543
Offset: 0

Views

Author

Iain Fox, Jan 08 2018

Keywords

Comments

For n > 0, in binary, this is a 1 followed by n-1 0's followed by 10 followed by n 1's.

Examples

			a(0) = 2*4^0 + 3*2^0 - 1 = 4;   in binary, 100.
a(1) = 2*4^1 + 3*2^1 - 1 = 13;  in binary, 1101.
a(2) = 2*4^2 + 3*2^2 - 1 = 43;  in binary, 101011.
a(3) = 2*4^3 + 3*2^3 - 1 = 151; in binary, 10010111.
a(4) = 2*4^4 + 3*2^4 - 1 = 559; in binary, 1000101111.
...
		

Crossrefs

A lower bound for A296807.

Programs

  • Mathematica
    Table[2 4^n+3 2^n-1,{n,0,30}] (* or *) LinearRecurrence[{7,-14,8},{4,13,43},30] (* Harvey P. Dale, Apr 22 2018 *)
  • PARI
    a(n) = 2*4^n + 3*2^n - 1
    
  • PARI
    first(n) = Vec((4 - 15*x + 8*x^2)/((1 - x)*(1 - 2*x)*(1 - 4*x)) + O(x^n))

Formula

G.f.: (4 - 15*x + 8*x^2)/((1 - x)*(1 - 2*x)*(1 - 4*x)).
E.g.f.: 2*e^(4*x) + 3*e^(2*x) - e^x.
a(n) = 7*a(n-1) - 14*a(n-2) + 8*a(n-3), n > 2.
a(n) = A000918(n) + A085601(n).

A297962 Take a prime, convert it to base 2. Remove its most significant digit and its least significant digit; repeat this process. a(n) is the least prime that, in the first n steps of this process, generates n primes.

Original entry on oeis.org

13, 59, 631, 7039, 64063, 761087, 3619327, 74347519, 1577707519, 22200700927, 1668463173631, 290703062134783, 3413184213843967, 121597545150218239
Offset: 1

Views

Author

Paolo Iachia, Paolo P. Lava, Jan 09 2018

Keywords

Comments

From Jon E. Schoenfield, Jan 11 2018: (Start)
a(15) <= 6937869050647642111;
a(16) <= 7088202090368908328959;
a(17) <= 348624306087955627410980863. (End)

Examples

			a(1) = 13, because 13 in base 2 is 1101, 10 is the prime 2; and 13 is the least prime with this property.
a(2) = 59, because 59 = 111011_2, 1101_2 is the prime 13, 10_2 is the prime 2; and 59 is the least prime with this property.
a(3) = 631, because 631 = 1001110111_2, 111011_2 is the prime 59, 1101_2 is the prime 13, 10_2 is the prime 2; and 631 is the least prime with this property.
		

Crossrefs

Programs

  • Java
    private static BigInteger SearchAn() { BigInteger BIW, BICore; int tN=10; int j3; static final BigInteger BILim = new BigInteger("1000000000"); static final BigInteger BI2 = new BigInteger("2");for (BIW=BI2; BIW.compareTo(BILim)<0; BIW=BIW.add(BI2)) { BICore = BIW;  for (j3=1;j3
    				
  • Maple
    with(numtheory): P:=proc(q) local a,i,k,n,ok,x; x:=1;
    for n from 1 to q do for k from x to q do
    a:=convert(ithprime(k),binary,decimal);
    ok:=1; for i from 1 to n do a:=trunc(a/10) mod 10^(ilog10(a)-1);
    if not isprime(convert(a,decimal,binary)) then ok:=0; break; fi; od;
    if ok=1 then x:=k; print(ithprime(k)); break; fi; od; od; end: P(10^10);
  • Mathematica
    With[{s = Map[LengthWhile[#, PrimeQ] &@ NestWhileList[((# - 2^Floor@ Log2@ #) - 1)/2 &, #, # > 2 &] &, Prime@ Range[2^18]]}, Map[Prime@ First@ FirstPosition[s, #] &, Range@ Max@ s]] (* Michael De Vlieger, Jan 10 2018 *)

Formula

Let C(p) be the result of removing the MSD and the LSD of a prime p. C(p) = (p - 2^floor(log_2(p)) - 1)/2.

Extensions

a(10)-a(14) from Jon E. Schoenfield, Jan 11 2018
Showing 1-3 of 3 results.