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

A065381 Primes not of the form p + 2^k, p prime and k >= 0.

Original entry on oeis.org

2, 127, 149, 251, 331, 337, 373, 509, 599, 701, 757, 809, 877, 907, 977, 997, 1019, 1087, 1259, 1549, 1597, 1619, 1657, 1759, 1777, 1783, 1867, 1973, 2203, 2213, 2293, 2377, 2503, 2579, 2683, 2789, 2843, 2879, 2909, 2999, 3119, 3163, 3181, 3187, 3299
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2001

Keywords

Comments

Sequence is infinite. For example, Pollack shows that numbers which are 1260327937 mod 2863311360 are not of the form p + 2^k for any prime p and k >= 0, and there are infinitely many primes in this congruence class by Dirichlet's theorem. - Charles R Greathouse IV, Jul 20 2014

Examples

			127 is a prime, 127-2^0 through 127-2^6 are all nonprimes.
		

Crossrefs

Programs

  • Haskell
    a065381 n = a065381_list !! (n-1)
    a065381_list = filter f a000040_list where
       f p = all ((== 0) . a010051 . (p -)) $ takeWhile (<= p) a000079_list
    -- Reinhard Zumkeller, Nov 24 2011
    
  • Mathematica
    fQ[n_] := Block[{k = Floor[Log[2, n]], p = n}, While[k > -1 && ! PrimeQ[p - 2^k], k--]; If[k > 0, True, False]]; Drop[Select[Prime[Range[536]], ! fQ[#] &], {2}] (* Robert G. Wilson v, Feb 10 2005; corrected by Arkadiusz Wesolowski, May 05 2012 *)
  • PARI
    is(p)=my(k=1);while(kp,return(isprime(p)));0 \\ Charles R Greathouse IV, Jul 20 2014

Formula

A078687(A049084(a(n))) = 0; subsequence of A118958. - Reinhard Zumkeller, May 07 2006

Extensions

Link and cross-reference fixed by Charles R Greathouse IV, Nov 09 2008

A091932 Primes that remain prime when their leading digit in binary representation is replaced by 0.

Original entry on oeis.org

7, 11, 13, 19, 23, 29, 37, 43, 61, 67, 71, 83, 101, 107, 131, 139, 151, 157, 181, 199, 211, 229, 241, 263, 269, 293, 317, 353, 359, 383, 419, 449, 467, 479, 523, 541, 571, 601, 613, 619, 643, 661, 691, 709, 739, 751, 769, 823, 829, 859, 991, 1021, 1031, 1061
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2004

Keywords

Comments

A053645(a(n)) is prime.
Primes p such that p - 2^floor(log_2(p)) is prime - T. D. Noe, Apr 08 2011

Examples

			A000040(12)=37 --> '100101' --> '[1]00101' --> '[0]00101' --> '101' --> 5, therefore 37 is a term.
		

Crossrefs

Cf. A091931.
Cf. A118958.

Programs

  • Mathematica
    Select[Prime[Range[100]], PrimeQ[# - 2^Floor[Log[2, #]]] &] (* T. D. Noe, Apr 08 2011 *)
    Select[Prime[Range[200]],PrimeQ[FromDigits[Rest[ IntegerDigits[ #,2]],2]]&] (* Harvey P. Dale, Apr 08 2016 *)
  • Python
    from sympy import isprime, primerange
    def ok(p): return isprime((1 << (p.bit_length()-1)) ^ p)
    def aupto(lim): return [p for p in primerange(1, lim+1) if ok(p)]
    print(aupto(1061)) # Michael S. Branicky, Jul 11 2021

Formula

A118953(A049084(a(n))) = 1; subsequence of A065380. - Reinhard Zumkeller, May 07 2006

A118957 Numbers of the form 2^k + p, where p is a prime less than 2^k.

Original entry on oeis.org

6, 7, 10, 11, 13, 15, 18, 19, 21, 23, 27, 29, 34, 35, 37, 39, 43, 45, 49, 51, 55, 61, 63, 66, 67, 69, 71, 75, 77, 81, 83, 87, 93, 95, 101, 105, 107, 111, 117, 123, 125, 130, 131, 133, 135, 139, 141, 145, 147, 151, 157, 159, 165, 169, 171, 175, 181, 187, 189, 195, 199
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Crossrefs

Complement of A118956; subsequence of A118955.

Programs

  • Maple
    isA118957 := proc(n)
        local twok,p ;
        twok := 1 ;
        while twok < n-1 do
            p := n-twok ;
            if isprime(p) and p < twok then
                return true;
            end if;
            twok := twok*2 ;
        end do:
        return false;
    end proc:
    for n from 1 to 200 do
        if isA118957(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Feb 27 2015
  • Mathematica
    okQ[n_] := Module[{k, p}, For[k = Ceiling[Log[2, n]], k>1, k--, p = n-2^k; If[2 <= p < 2^k && PrimeQ[p], Return[True]]]; False]; Select[Range[200], okQ] (* Jean-François Alcover, Mar 11 2019 *)
  • PARI
    is(n)=isprime(n-2^logint(n,2)) \\ Charles R Greathouse IV, Sep 01 2015; edited Jan 24 2024
    
  • Python
    from sympy import primepi
    def A118957(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(primepi(min(x-(m:=1<Chai Wah Wu, Feb 23 2025

Formula

A118952(a(n)) = 1.

A118953 Number of ways to write the n-th prime as 2^k + p, where p is prime and p < 2^k.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Comments

0 <= a(n) <= 1, a(n) <= A078687(n);
a(A049084(A118958(n))) = 0, a(A049084(A091932(n))) = 1;
a(n) = A118952(A000040(n)).
Showing 1-4 of 4 results.