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.

A118954 Numbers that cannot be written as 2^k + prime.

Original entry on oeis.org

1, 2, 16, 22, 26, 28, 36, 40, 46, 50, 52, 56, 58, 64, 70, 76, 78, 82, 86, 88, 92, 94, 96, 100, 106, 112, 116, 118, 120, 122, 124, 126, 127, 134, 136, 142, 144, 146, 148, 149, 154, 156, 160, 162, 166, 170, 172, 176, 178, 184, 186, 188, 190, 196, 202, 204, 206, 208
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Comments

A109925(a(n)) = 0.

Crossrefs

Complement of A118955. Subsequence of A118956. Supersequence of A006285.

Programs

  • Haskell
    a118954 n = a118954_list !! (n-1)
    a118954_list = filter f [1..] where
       f x = all (== 0) $ map (a010051 . (x -)) $ takeWhile (< x) a000079_list
    -- Reinhard Zumkeller, Jan 03 2014
    
  • Magma
    lst:=[]; for n in [1..208] do k:=-1; repeat k+:=1; a:=n-2^k; until a lt 1 or IsPrime(a); if a lt 1 then Append(~lst, n); end if; end for; lst; // Arkadiusz Wesolowski, Sep 02 2016
  • PARI
    is(n)=my(k=1);while(kCharles R Greathouse IV, Sep 01 2015
    

Formula

n < a(n) < kn for some k < 2 and all large enough n, see Romanoff and either Erdős or van der Corput. - Charles R Greathouse IV, Sep 01 2015

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.

A118952 Characteristic function of numbers that can be written as p+2^k, where p is prime and p less than 2^k (A118957).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Comments

0 <= a(n) <= 1, a(n) <= A109925(n);
a(A118956(n)) = 0, a(A118957(n)) = 1;
A118953(n) = a(A000040(n)).
Showing 1-3 of 3 results.