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.

A340707 a(n) = (prevprime(2^n) + nextprime(2^n))/2 - 2^n where prevprime(n) = A151799(n) and nextprime(n) = A151800(n).

Original entry on oeis.org

0, 1, -1, 2, 0, 1, -2, 3, 2, -2, 0, 8, 12, -8, -7, 14, -1, 10, 2, 4, 6, -3, 20, -2, 5, -5, -27, 4, -16, 5, 5, 4, -8, 11, 13, -8, -19, 8, -36, 3, 2, -14, -5, 2, -3, -55, -19, -6, 14, -54, -13, -53, 63, -26, 38, -2, 21, 38, -30, 7, 39, 2, -23, 41, 2, -8, 5, 5, -5, -110
Offset: 2

Views

Author

Hugo Pfoertner, Jan 29 2021

Keywords

Comments

a(n) > 0 if the difference nextprime(2^n) - 2^n = A013597(n) is greater than the difference 2^n - previousprime(2^n) = A013603(n).

Examples

			a(4) = -1: 2^4 = 16, (13 + 17 - 32)/2 = -1;
a(5) = 2: 2^5 = 32, (31 + 37 - 64)/2 = 2;
a(6) = 0: 2^6 = 64, (61 + 67 - 128)/2 = 0.
		

Crossrefs

Programs

  • Maple
    a:= (p-> (nextprime(p)+prevprime(p))/2-p)(2^n):
    seq(a(n), n=2..75);  # Alois P. Heinz, Jan 29 2021
  • Mathematica
    Array[(NextPrime[2^#] + NextPrime[2^#, -1] - 2^(# + 1))/2 &, 60, 2] (* Michael De Vlieger, Aug 07 2022 *)
  • PARI
    for(k=2,71,my(p2=2^k,pp=precprime(p2),pn=nextprime(p2));if(print1((pp+pn-2*p2)/2", ")))

Formula

a(n) = (A013597(n) - A013603(n))/2.
a(A226178(n)) = 0.

Extensions

Name made more precise by Peter Luschny, Aug 08 2022

A356434 Prime nearest to 2^n. In case of a tie, choose the larger.

Original entry on oeis.org

2, 2, 5, 7, 17, 31, 67, 127, 257, 509, 1021, 2053, 4099, 8191, 16381, 32771, 65537, 131071, 262147, 524287, 1048573, 2097143, 4194301, 8388617, 16777213, 33554467, 67108859, 134217757, 268435459, 536870909, 1073741827, 2147483647, 4294967291, 8589934583
Offset: 0

Views

Author

Peter Munn, Aug 07 2022

Keywords

Crossrefs

A117387 differs by preferring the smaller prime in the case of a tie, which occurs when n is in A226178.

Programs

  • Mathematica
    Join[{2,2},Table[Max[Nearest[{NextPrime[2^n,-1],NextPrime[2^n]},2^n]],{n,2,40}]] (* Harvey P. Dale, Feb 19 2023 *)
  • Python
    from sympy import prevprime, nextprime
    def A356434(n): return (r if (m:=nextprime(k:=1< (k<<1)-(r:=prevprime(k)) else m) if n>1 else 2 # Chai Wah Wu, Aug 08 2022

Formula

a(0) = 2; for n >= 1, if A014210(n) + A014234(n) > 2^(n+1) then a(n) = A014234(n), otherwise a(n) = A014210(n).

A372263 Least odd prime factor of the n-th sum of two consecutive primes, A001043(n) = prime(n) + prime(n+1), or 2 if there is no odd prime factor.

Original entry on oeis.org

5, 2, 3, 3, 3, 3, 3, 3, 13, 3, 17, 3, 3, 3, 5, 7, 3, 2, 3, 3, 19, 3, 43, 3, 3, 3, 3, 3, 3, 3, 3, 67, 3, 3, 3, 7, 5, 3, 5, 11, 3, 3, 3, 3, 3, 5, 7, 3, 3, 3, 59, 3, 3, 127, 5, 7, 3, 137, 3, 3, 3, 3, 3, 3, 3, 3, 167, 3, 3, 3, 89, 3, 5, 47, 3, 193, 3, 3, 3, 3, 3, 3, 3, 109, 3, 223
Offset: 1

Views

Author

M. F. Hasler, Apr 24 2024

Keywords

Comments

Since the sum of any two primes > 2 is even, we rather consider odd prime factors.
Can it be proved or disproved that there are primes that occur only finitely many times (or never) in this sequence? If so, which is the smallest such prime?
From Robert Israel, Dec 29 2024: (Start)
Dickson's conjecture implies that every odd prime occurs infinitely many times in the sequence.
a(n) = 2 if and only if n = A000720(2^k) where k is in A226178. (End)

Examples

			Sums of two consecutive primes are given as s(n) = A001043(n). The least odd prime factor (or 2 if there's no odd prime factor) of these terms is a(n):
n = 1, 2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,  15,  16,  17,  18, ...
s = 5, 8, 12, 18, 24, 30, 36, 42, 52, 60, 68, 78, 84, 90, 100, 112, 120, 128, ...
a = 5, 2,  3,  3,  3,  3,  3,  3, 13,  3, 17,  3,  3,  3,   5,   7,   3,   2, ...
Also, a(21) = spf(152) = 19; a(23) = spf(172) = 43; a(32) = spf(268) = 67, ...
		

Crossrefs

Cf. A001043 (sums of two consecutive primes), A078701 (least odd prime divisor), A020639 (spf: least prime factor), A000265 (odd part of n), A000079 (powers of 2).
Cf. A024677 (spf of A024675(n) = A001043(n)/2).
Cf. A226178.

Programs

  • Maple
    f:= proc(n) subs(infinity=2,min(numtheory:-factorset(ithprime(n)+ithprime(n+1)) minus {2})) end proc:
    map(f, [$1..100]); # Robert Israel, Dec 29 2024
  • PARI
    apply( {a(n) = max(A078701(A001043(n)), 2)}, [1..99])
    /* a "self-contained" but less efficient definition:
    a(n) = factor(max((n=prime(n)+prime(n+1))>>valuation(n,2),2))[1,1] */

Formula

a(n) = max(A078701(A001043(n)), 2) = A020639(max(A000265(A001043(n)), 2)), where A000265(m) > 2 unless m is in A000079.
Showing 1-3 of 3 results.