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.

A218044 Numbers of the form 2^k + prime, with k > 0.

Original entry on oeis.org

4, 5, 6, 7, 9, 10, 11, 13, 15, 17, 18, 19, 21, 23, 25, 27, 29, 31, 33, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 66, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119
Offset: 1

Views

Author

Michel Marcus, Oct 19 2012

Keywords

Comments

A039669 is included in this sequence.

Examples

			5 = 3 + 2 that is, a prime and a power of 2.
		

Crossrefs

Cf. A080340, A039669, A118955 (allows k=0).

Programs

  • Maple
    q:= n-> ormap(isprime, [seq(n-2^k, k=1..ilog2(n))]):
    select(q, [$0..200])[];  # Alois P. Heinz, Feb 14 2020
  • Mathematica
    nn = 119; ps = Prime[Range[PrimePi[nn]]]; p2 = 2^Range[Log[2, nn]]; u = {}; Do[u = Union[u, ps + p2[[i]]], {i, Length[p2]}]; Select[u, # <= nn &] (* T. D. Noe, Oct 19 2012 *)
  • PARI
    isok(n) = {forprime(p=2, n, my(d = n - p); if ((d==2) || (ispower(d,,&k) && (k==2)), return(1));); 0;} \\ Michel Marcus, Apr 18 2016