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.

User: Paolo Iachia

Paolo Iachia's wiki page.

Paolo Iachia has authored 5 sequences.

A306400 For the n-th prime p of the form 6k-1, a(n) is the first prime q for which (p+q^2-1, p+q^2+1) is a twin prime pair.

Original entry on oeis.org

5, 7, 5, 7, 11, 23, 5, 7, 7, 11, 5, 7, 7, 11, 5, 7, 701, 7, 5, 5, 7, 7, 41, 11, 7, 19, 13, 5, 7, 31, 17, 13, 11, 31, 41, 13, 31, 7, 29, 11, 37, 13, 53, 11, 19, 19, 11, 13, 23, 37, 7, 41, 23, 7, 29, 5, 71, 5, 13, 29, 13, 13, 59, 97, 11, 37, 17, 7, 7, 5, 7, 157
Offset: 1

Author

Paolo Iachia, Mar 25 2019

Keywords

Comments

Actually, there is no need to test for q=2 and q=3, as 6k-1+4+-1 = (6k+2, 6k+4), both terms not prime; and 6k-1+9+-1 = (6k+7,6k+9), with 6k+9 not prime.
The sequence could be extended to nonprime numbers p=6k-1 and/or nonprime numbers q=6t+-1. However, it could not be extended to p=6k+1 (prime or not), because for q=6t+-1, p+q^2 = 6k+1+36t^2+-12t+1 ≡ 2 (mod 6); hence p+q^2+1 == 3 (mod 6) is never a prime number.
Proving that this sequence is infinite would prove the twin prime conjecture (that there are infinitely many twin primes), as the twin prime pair associated with the prime p is greater than p and there are infinitely many prime numbers.
This sequence refers to the first q for which p+q^2+-1 is a twin prime pair. However, analysis (by computer program) suggests that for each prime p there are infinitely many primes q for which p+q^2+-1 is a twin prime pair. Proving this statement, even for a single prime p, would prove the twin prime conjecture.

Examples

			Example: for n=5, a(5) = 11, because the 5th prime of the form 6k-1 is 29, and 29+11^2+-1 = (149,151) is a twin prime pair, while 29+2^2+-1, 29+3^2+-1, 29+5^2+-1, 29+7^2+-1 are not twin prime pairs.
		

Crossrefs

Cf. A007528, A001359 (lesser of twin primes).

Programs

  • Maple
    g:= proc(p) local q;
      q:= 3:
      do
        q:= nextprime(q);
        if isprime(p+q^2-1) and isprime(p+q^2+1) then return q fi;
      od
    end proc:
    map(g, select(isprime, [seq(i,i=5..1000,6)])); # Robert Israel, Nov 23 2020
  • Mathematica
    Table[Block[{q = 2}, While[! AllTrue[p + q^2 + {-1, 1}, PrimeQ], q = NextPrime@ q]; q], {p, Select[Range[5, 825, 6], PrimeQ]}] (* Michael De Vlieger, Mar 31 2019 *)
  • PARI
    lista(nn) = {forprime(p=2, nn, if (((p+1) % 6) == 0, my(q=5); while (!(isprime(p+q^2-1) && isprime(p+q^2+1)), q = nextprime(q+1)); print1(q, ", ");););} \\ Michel Marcus, Mar 26 2019

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

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

A296807 Take a prime, convert it to base 2. Consider it as a string of digits and delete its leftmost and rightmost digit. Leading zeros are kept. Repeat the process. a(n) is the least prime that, in the first n steps of this process, generates a string that is a prime read in base 2.

Original entry on oeis.org

2, 13, 43, 151, 2143, 2143, 12479, 57727, 246527, 4267455487, 276009615632383, 4469780781584383, 576406542684520447
Offset: 0

Author

Paolo P. Lava, Paolo Iachia, Dec 21 2017

Keywords

Comments

a(n) >= 2*4^n + 3*2^n - 1 = A297928(n) >= 2*(4^n + 2^n) + 1 = A085601(n), n > 0. - Iain Fox, Dec 29 2017 (edited by Iain Fox, Jan 08 2018)
a(17) <= 2^163 + 361736822347711983585853439 (probably much smaller), building on a Cunningham chain of length 17 found by Jaroslaw Wroblewski. a(n) exists for n <= 17, and probably for all n. - Jens Kruse Andersen, Jan 21 2018

Examples

			a(1) = 13 because 13 in base 2 is 1101 and 10 is 2 and 13 is the least number with this property;
a(2) = 43 because 43 in base 2 is 101011 while 0101 is 5 and 10 is 2 and 43 is the least number with this property;
a(3) = 151 because 151 in base 2 is 10010111 while 001011 is 11, 0101 is 5 and 10 is 2 and 151 is the least number with this property.
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(q) local a,b,c,i,j,k,n,ok,x; x:=5; for k from 1 to q do for n from x to q do a:=convert(ithprime(n),base,2); ok:=1; for i from 1 to k do b:=nops(a)-i; while a[b]=0 do b:=b-1; od;
    c:=0; for j from b by -1 to i+1 do c:=2*c+a[j]; od;if not isprime(c) then ok:=0; break; fi; od;if ok=1 then x:=n; print(ithprime(n)); break; fi; od; od; end: P(10^20);
  • Mathematica
    Table[SelectFirst[Prime@ Range[#, # + 10^5] &@ PrimePi[2 (4^n + 2^n) + 1], AllTrue[Map[FromDigits[#, 2] &, Rest@ NestWhileList[Most@ Rest@ # &, IntegerDigits[#, 2], Length@ # > 2 &]], PrimeQ] &], {n, 8}] (* Michael De Vlieger, Dec 29 2017 *)
  • PARI
    a(n) = if(!n, return(2)); forprime(p=2*4^n + 3*2^n - 1, , my(b=p); for(x=1, n, b = (b - (b>=4*2^(logint(p, 2) - 2*x))*4*2^(logint(p, 2) - 2*x) - 1)/2; if(!isprime(b) || (b==2 && x!=n), next(2))); return(p)) \\ Iain Fox, Dec 29 2017 (corrected by Iain Fox, Oct 26 2019)

Extensions

Definition corrected, a(10)-a(12) by Jens Kruse Andersen, Jan 21 2018

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

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.
		

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.

A279610 a(n) = concatenate n consecutive integers, starting with the last number of the previous batch.

Original entry on oeis.org

1, 12, 234, 4567, 7891011, 111213141516, 16171819202122, 2223242526272829, 293031323334353637, 37383940414243444546, 4647484950515253545556, 565758596061626364656667, 67686970717273747576777879, 7980818283848586878889909192
Offset: 1

Author

José de Jesús Camacho Medina, Dec 09 2016, and Paolo Iachia, Dec 15 2016

Keywords

Comments

A variant of A053067. The first number of the concatenation a(n) is A152947(n) = (n-2)*(n-1)/2+1 and the last is (n-1)*n/2+1.
The fourth term, 4567, is a prime. When is the next prime, if there is another? - N. J. A. Sloane, Dec 16 2016
a(n) is the concatenation of the terms of the n-th row of A122797 when seen as a triangle. - Michel Marcus, Dec 17 2016

Examples

			a(4) is the concatenation of 4 numbers beginning with the last number (4) that was used to build a(3), so a(4) = 4 5 6 7 = 4567. Then a(5) is the concatenation of 5 numbers beginning with the last number of a(4), which is 7, so a(5) = 7 8 9 10 11 = 7891011. And so on.
For n = 3, n^2/2 - n/2 + 1 = 4; a(3) = 4 + 3*10^1 + 2*10^(1+1) = 234.
		

Crossrefs

A subsequence of A035333. For primes in latter, see A052087.

Programs

  • Mathematica
    Table[FromDigits[Flatten[IntegerDigits /@ Range[(n(n - 1))/2 + 1, (n(n + 1))/2 + 1 ]]], {n, 0, 20}]
  • Python
    from _future_ import division
    def A279610(n):
        return int(''.join(str(d) for d in range((n-1)*(n-2)//2+1,n*(n-1)//2+2))) # Chai Wah Wu, Dec 17 2016

Formula

a(n) = n^2/2 - n/2 + 1 + Sum{k=1..n-1} ((n^2/2 - n/2 + 1 - k)*10^Sum{j=0..k-1} (floor(1+log_10(n^2/2 - n/2 + 1 - j)))).