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.

Previous Showing 21-30 of 50 results. Next

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.

A118958 Primes that cannot be written as 2^k + p with p prime < 2^k.

Original entry on oeis.org

2, 3, 5, 17, 31, 41, 47, 53, 59, 73, 79, 89, 97, 103, 109, 113, 127, 137, 149, 163, 167, 173, 179, 191, 193, 197, 223, 227, 233, 239, 251, 257, 271, 277, 281, 283, 307, 311, 313, 331, 337, 347, 349, 367, 373, 379, 389, 397, 401, 409, 421, 431, 433, 439, 443
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Comments

A118953(A049084(a(n))) = 0; A065381 is a subsequence.

Crossrefs

Programs

  • Maple
    filter:= proc(n) not isprime(n-2^ilog2(n)) end proc:
    select(filter, [seq(ithprime(i),i=1..100)]); # Robert Israel, Jan 27 2021
  • Mathematica
    okQ[n_] := !PrimeQ[n-2^(Length[IntegerDigits[n, 2]]-1)];
    Select[Prime[Range[100]], okQ] (* Jean-François Alcover, Feb 04 2023 *)

A303949 Number of ways to write 2*n+1 as p + 2*(2^k+5^m) with p prime and 2^k+5^m a product of at most three distinct primes, where k and m are nonnegative integers.

Original entry on oeis.org

0, 0, 1, 2, 2, 2, 3, 5, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 3, 4, 4, 5, 5, 4, 4, 5, 5, 6, 4, 3, 6, 7, 3, 6, 9, 7, 5, 8, 7, 6, 7, 9, 7, 8, 2, 8, 9, 5, 5, 6, 6, 7, 6, 6, 7, 10, 6, 7, 9, 5, 6, 8, 6, 3, 6, 7, 7, 8, 5, 10, 9, 8, 5, 9, 5, 7, 10, 5, 4, 10, 7, 6, 8, 6, 7, 8, 7, 6, 8, 6
Offset: 1

Views

Author

Zhi-Wei Sun, May 05 2018

Keywords

Comments

4787449 is the first value of n > 2 with a(n) = 0, and 2*4787449+1 = 9574899 has the unique representation as p + 2*(2^k+5^m): 9050609 + 2*(2^18+5^0) with 9050609 prime and 2^18+5^0 = 5*13*37*109.
See also A303934 and A304081 for related conjectures.

Examples

			a(3) = 1 since 2*3+1 = 3 + 2*(2^0+5^0) with 3 prime.
		

Crossrefs

Programs

  • Mathematica
    qq[n_]:=qq[n]=SquareFreeQ[n]&&Length[FactorInteger[n]]<=3;
    tab={};Do[r=0;Do[If[SquareFreeQ[2^k+5^m]&&PrimeQ[2n+1-2(2^k+5^m)],r=r+1],{k,0,Log[2,n]},{m,0,Log[5,n+1/2-2^k]}];tab=Append[tab,r],{n,1,90}];Print[tab]

A304032 Number of ways to write 2*n as p + 2^k + 3^m with p prime and 2^k + 3^m a product of at most two distinct primes, where k and m are nonnegative integers.

Original entry on oeis.org

0, 1, 1, 3, 4, 4, 4, 6, 6, 5, 8, 9, 4, 6, 7, 4, 9, 10, 6, 9, 10, 6, 11, 14, 7, 9, 11, 5, 10, 9, 6, 12, 10, 3, 11, 15, 7, 12, 16, 7, 9, 14, 9, 12, 14, 8, 12, 16, 5, 12, 18, 10, 12, 16, 9, 12, 19, 10, 13, 17, 6, 10, 15, 6, 10, 16, 10, 12, 15, 10, 17, 20, 8, 14, 15, 8, 11, 18, 9, 12
Offset: 1

Views

Author

Zhi-Wei Sun, May 04 2018

Keywords

Comments

The even number 58958 cannot be written as p + 2^k + 3^m with p and 2^k + 3^m both prime.
Clearly, a(n) <= A303702(n). We note that a(n) > 0 for all n = 2..5*10^8.
See also A304034 for a related conjecture.

Examples

			a(3) = 1 since 2*3 = 3 + 2^1 + 3^0 with 3 = 2^1 + 3^0 prime.
		

References

  • J. R. Chen, On the representation of a larger even integer as the sum of a prime and the product of at most two primes, Sci. Sinica 16(1973), 157-176.

Crossrefs

Programs

  • Mathematica
    qq[n_]:=qq[n]=SquareFreeQ[n]&&Length[FactorInteger[n]]<=2;
    tab={};Do[r=0;Do[If[qq[2^k+3^m]&&PrimeQ[2n-2^k-3^m],r=r+1],{k,0,Log[2,2n-1]},{m,0,Log[3,2n-2^k]}];tab=Append[tab,r],{n,1,80}];Print[tab]

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

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 131, 137, 139, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 257, 263, 269, 271, 277, 281, 283, 293
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2001

Keywords

Examples

			a(3) = 11 = 3 + 2^3 = 7 + 2^2.
		

Crossrefs

Programs

  • Haskell
    a065380 n = a065380_list !! (n-1)
    a065380_list = filter f a000040_list where
       f p = any ((== 1) . a010051 . (p -)) $ takeWhile (<= p) a000079_list
    -- Reinhard Zumkeller, Nov 24 2011
  • Mathematica
    With[{upto=300},Select[Union[Select[Flatten[Outer[Plus,Prime[Range[ PrimePi[upto]]],2^Range[0,Floor[Log[2,upto]]]]],PrimeQ]],#<=upto&]] (* Harvey P. Dale, Feb 28 2012 *)

Formula

A078687(A049084(a(n))) > 0; A091932 is a subsequence. - Reinhard Zumkeller, May 07 2006

A154417 Number of ways to express n as the sum of an odd prime, a positive Fibonacci number and half of a positive Fibonacci number.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 2, 4, 3, 3, 4, 3, 4, 3, 4, 5, 2, 5, 5, 4, 6, 6, 4, 9, 5, 5, 6, 6, 5, 5, 6, 7, 3, 8, 6, 6, 7, 4, 5, 8, 5, 9, 4, 7, 6, 5, 7, 9, 5, 7, 4, 6, 6, 6, 7, 5, 4, 8, 3, 8, 8, 6, 6, 7, 7, 8, 6, 6, 6, 4, 6, 8, 3, 9, 8, 7, 10, 10, 8, 8, 8, 7, 6, 12, 7, 6, 10, 7, 7, 10, 10, 9, 5, 7, 11, 9, 10, 6, 6, 8
Offset: 1

Views

Author

Zhi-Wei Sun, Jan 09 2009

Keywords

Comments

On Jan 09 2009, Zhi-Wei Sun conjectured that a(n)>0 for every n=5,6,...; in other words, any integer n>4 can be written in the form p+F_s+F_{3t}/2 with p an odd prime and s,t>0. Sun verified this up to 5*10^6 and Qing-Hu Hou continued the verification (on Sun's request) up to 3*10^8. Note that 932633 cannot be written as p+F_s+F_{3t}/2 with p a prime and (F_s or F_{3t}/2) odd. If we set u_0=0, u_1=1 and u_{n+1}=4u_n+u_{n-1} for n=1,2,3,..., then F_{3t}/2=u_t is at least 4^{t-1} for each t=1,2,3,.... In a recent paper K. J. Wu and Z. W. Sun constructed a residue class which contains no integers of the form p+F_{3t}/2 with p a prime and t nonnegative.

Examples

			For n=9 the a(9)=4 solutions are 3 + F_5 + F_3/2, 3 + F_3 + F_6/2, 5 + F_4 + F_3/2, 7 + F_2 + F_3/2.
		

References

  • R. Crocker, On a sum of a prime and two powers of two, Pacific J. Math. 36(1971), 103-107.

Crossrefs

Programs

  • Mathematica
    PQ[m_]:=m>2&&PrimeQ[m] RN[n_]:=Sum[If[PQ[n-Fibonacci[3x]/2-Fibonacci[y]],1,0], {x,1,Log[2,n]+1},{y,2,2*Log[2,Max[2,n-Fibonacci[3x]/2]]}] Do[Print[n," ",RN[n]];Continue,{n,1,50000}]

Formula

a(n) = |{: p+F_s+F_{3t}/2=n with p an odd prime, s>1 and t>0}|.

A232548 Number of ways to write n = p - pi(p) + 2^k + 2^m with 0 < k <= m, where p is an odd prime and pi(p) is the number of primes not exceeding p.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 1, 2, 2, 3, 2, 3, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 3, 5, 4, 2, 3, 4, 4, 3, 3, 4, 6, 4, 5, 6, 4, 4, 5, 4, 6, 4, 4, 5, 5, 4, 5, 5, 4, 5, 4, 5, 5, 4, 3, 4, 5, 5, 6, 4, 4, 5, 4, 5, 6, 7, 7, 4, 5, 5, 6, 4, 7, 6, 6, 6, 4, 6, 4, 7, 8, 7, 6, 6, 6, 6, 5, 4, 9, 7, 5, 4, 4, 7, 6, 3, 7, 8
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 25 2013

Keywords

Comments

Conjecture: a(n) > 0 for all n > 4.
In contrast, R. Crocker proved that there are infinitely many positive odd integers not of the form p + 2^k + 2^m, where p is a prime, and k and m are positive integers.
Qing-Hu Hou has checked the conjecture for n up to 10^7, and found one counterexample: n = 1897048.

Examples

			a(7) = 2 since 7 = 3 - pi(3) + 2 + 2^2 = 7 - pi(7) + 2 + 2, with 3 and 7 odd primes.
a(8) = 1 since 8 = 5 - pi(5) + 2 + 2^2 with 5 an odd prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Sum[If[n==Prime[k]-k+2^i+2^j,1,0],{k,2,PrimePi[2n]},{j,1,Log[2,n]},{i,1,j}]
    Table[a[n],{n,1,100}]
  • PARI
    a(n)=my(s,ppi=1); forprime(p=3,, if(p-ppi++>n-4,return(s)); if((n-p+ppi)%2==0 && hammingweight(n-p+ppi)<3,s++)) \\ Charles R Greathouse IV, Nov 27 2013

A133122 Odd numbers which cannot be written as the sum of an odd prime and 2^i with i > 0.

Original entry on oeis.org

1, 3, 127, 149, 251, 331, 337, 373, 509, 599, 701, 757, 809, 877, 905, 907, 959, 977, 997, 1019, 1087, 1199, 1207, 1211, 1243, 1259, 1271, 1477, 1529, 1541, 1549, 1589, 1597, 1619, 1649, 1657, 1719, 1759, 1777, 1783, 1807, 1829, 1859, 1867, 1927, 1969, 1973
Offset: 1

Views

Author

David S. Newman, Sep 18 2007

Keywords

Comments

The sequence of "obstinate numbers", that is, odd numbers which cannot be written as prime + 2^i with i >= 0 is the same except for the initial 3. - N. J. A. Sloane, Apr 20 2008
The reference by Nathanson gives on page 206 a theorem of Erdos: There exists an infinite arithmetic progression of odd positive integers, none of which is of the form p+2^k.
Essentially the same as A006285. - R. J. Mathar, Jun 08 2008

Examples

			The integer 7 can be represented as 2^2 + 3, therefore it is not on this list. - _Michael Taktikos_, Feb 02 2009
a(2)=127 because none of the numbers 127-2, 127-4, 127-8, 127-16, 127-32, 127-64 is a prime.
		

References

  • Nathanson, Melvyn B.; Additive Number Theory: The Classical Bases; Springer 1996
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 62.

Crossrefs

Programs

  • Maple
    (Maple program which returns -1 iff 2n+1 is obstinate, from N. J. A. Sloane, Apr 20 2008): f:=proc(n) local i,t1; t1:=2*n+1; i:=0; while 2^i < t1 do if isprime(t1-2^i) then RETURN(1); fi; i:=i+1; end do; RETURN(-1); end proc;
  • Mathematica
    s = {}; Do[Do[s = Union[s, {Prime[n] + 2^i}], {n, 2, 200}], {i, 1, 10}]; Print[Complement[Range[3, 1000, 2], s]]
    zweier = Map[2^# &, Range[0,30]]; primes = Table[Prime[i], {i, 1, 300}]; summen = Union[Flatten[ Table[zweier[[i]] + primes[[j]], {i, 1, 30}, {j, 1, 300}]]]; us = Select[summen, OddQ[ # ] &]; odds = Range[1, 1001, 2]; Complement[odds, us] (* Michael Taktikos, Feb 02 2009 *)

Extensions

More terms and corrected definition from Stefan Steinerberger, Sep 24 2007
Edited by N. J. A. Sloane, Feb 12 2009 at the suggestion of R. J. Mathar

A154364 Number of ways to express n as the sum of an odd prime, a positive Pell number and a companion Pell number.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 1, 1, 3, 2, 2, 1, 4, 2, 2, 2, 4, 3, 4, 5, 4, 3, 4, 3, 5, 4, 2, 3, 4, 4, 3, 4, 4, 3, 4, 4, 7, 4, 4, 3, 6, 3, 6, 5, 6, 4, 8, 5, 7, 4, 5, 3, 7, 5, 5, 5, 5, 4, 5, 3, 6, 4, 4, 4, 7, 4, 6, 4, 4, 2, 6, 3, 7, 6, 6, 6, 7, 6, 6, 3, 7, 6, 3, 4, 9, 9
Offset: 1

Views

Author

Zhi-Wei Sun, Jan 07 2009

Keywords

Comments

This is inspired by the sequence A154290 and related conjectures of Sun. On Jan 08 2009, Zhi-Wei Sun and Qing-Hu Hou conjectured that a(n)>0 for n=6,7,...; in other words, any integer n>5 can be written as the sum of an odd prime, a positive Pell number and a companian Pell number. The Pell numbers are defined by P_0=0, P_1=1 and P_{n+1}=2P_n+P_{n-1} (n=1,2,3,...) and the companion Pell numbers are given by Q_0=Q_1=2 and Q_{n+1}=2Q_n+Q_{n-1} (n=1,2,3...). Note that for n>5 both P_n and Q_n are greater than 2^n.
D. S. McNeil disproved the conjecture by finding the 4 initial counterexamples: 169421772576, 189661491306, 257744272674, 534268276332. - Zhi-Wei Sun, Jan 17 2009
On Feb 01 2009, Zhi-Wei Sun observed that these 4 counterexamples are divisible by 42 and guessed that all counterexamples to the conjecture of Sun and Hou should be multiples of 42. - Zhi-Wei Sun, Feb 01 2009

Examples

			For n=10 the a(10)=3 solutions are 3+5+2, 3+1+6, 7+1+2.
		

Crossrefs

Programs

  • Maple
    Pell:=proc(n) if n=0 then return(0); elif n=1 then return(1); else return( 2*Pell(n-1) + Pell(n-2) ); fi; end proc: comp_Pell:=proc(n) if n=0 then return(2); elif n=1 then return(2); else return( 2*comp_Pell(n-1) + comp_Pell(n-2) ); fi; end proc: for n from 1 to 10^5 do rep_num:=0; for i from 1 while Pell(i)2) and isprime(p) then rep_num:=rep_num+1; fi; od; od; printf("%d %d\n", n, rep_num); od:
  • Mathematica
    nmax = 10^3;
    Pell[n_] := Pell[n] = If[n == 0, Return[0], If[n == 1, Return[1], Return[2* Pell[n - 1] + Pell[n - 2]]]];
    compPell[n_] := compPell[n] = If[n == 0, Return[2], If[n == 1, Return[2],  Return[2*compPell[n - 1] + compPell[n - 2]]]];
    Reap[For[n = 1, n <= nmax, n++, repnum = 0; For[i = 1, Pell[i] < n, i++, For[j = 1, Pell[i] + compPell[j] < n, j++, p = n - Pell[i] - compPell[j]; If[p > 2 && PrimeQ[p], repnum++]]]; Sow[repnum]]][[2, 1]] (* Jean-François Alcover, Dec 13 2017, translated from Maple *)

A157218 Number of ways to write the n-th positive odd integer in the form p+2^x+7*2^y with p a prime congruent to 1 mod 6 and x,y positive integers.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 1, 0, 2, 3, 1, 1, 3, 1, 1, 4, 2, 3, 2, 1, 3, 3, 2, 3, 5, 1, 2, 5, 2, 4, 5, 1, 4, 3, 1, 4, 7, 1, 5, 7, 2
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 25 2009

Keywords

Comments

On Feb 24 2009, Zhi-Wei Sun conjectured that a(n)>0 for all n=18,19,...; in other words, any odd integer greater than 34 can be written as the sum of a prime congruent to 1 mod 6, a positive power of 2 and seven times a positive power of 2. Sun verified the conjecture for odd integers below 5*10^7, and Qing-Hu Hou continued the verification for odd integers below 1.5*10^8 (on Sun's request). Compare the conjecture with R. Crocker's result that there are infinitely many positive odd integers not of the form p + 2^x + 2^y with p an odd prime and x,y positive integers.

Examples

			For n=19 the a(19)=3 solutions are 2*19 - 1 = 7 + 2 + 7*2^2 = 7 + 2^4 + 7*2 = 19 + 2^2 + 7*2.
		

References

  • R. Crocker, On a sum of a prime and two powers of two, Pacific J. Math. 36(1971), 103-107.

Crossrefs

Programs

  • Mathematica
    PQ[x_]:=x>1&&Mod[x,6]==1&&PrimeQ[x] RN[n_]:=Sum[If[PQ[2n-1-7*2^x-2^y],1,0], {x,1,Log[2,(2n-1)/7]},{y,1,Log[2,Max[2,2n-1-7*2^x]]}] Do[Print[n," ",RN[n]],{n,1,200000}]

Formula

a(n) = |{: p+2^x+7*2^y=2n-1 with p a prime congruent to 1 mod 6 and x,y positive integers}|.
Previous Showing 21-30 of 50 results. Next