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.

A067526 Numbers n such that n - 2^k is a prime or 1 for all k satisfying 0 < k, 2^k < n.

Original entry on oeis.org

3, 4, 5, 7, 9, 15, 21, 45, 75, 105
Offset: 1

Views

Author

Amarnath Murthy, Feb 17 2002

Keywords

Comments

Is the sequence finite?
Next term, if it exists, exceeds 5*10^9. - Sean A. Irvine, Dec 18 2023

Examples

			45 belongs to this sequence as 45-2, 45-4, 45-8, 45-16, 45-32, i.e., 43, 41, 37, 29 and 13 are all primes.
		

Crossrefs

Cf. A039669 (n-2^k is prime).

Programs

  • Mathematica
    f[n_] := Block[{k = 1}, While[2^k < n, k++ ]; k--; k]; Do[ a = Table[n - 2^k, {k, 1, f[n]} ]; If[ a[[ -1]] == 1, a = Drop[a, -1]]; If[ Union[ PrimeQ[a]] == {True}, Print[n]], {n, 5, 10^7, 2} ]
  • Python
    from sympy import isprime
    def ok(n):
      k, pow2 = 1, 2
      while pow2 < n - 1:
        if not isprime(n-pow2): return False
        pow2 *= 2
      return (2 < n)
    print([m for m in range(1, 200) if ok(m)]) # Michael S. Branicky, Mar 04 2021

Extensions

Edited by Robert G. Wilson v, Feb 18 2002