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-10 of 14 results. Next

A109926 Least k such that k-2^r is prime for n values of r. Index of the first occurrence of n in A109925.

Original entry on oeis.org

1, 3, 4, 15, 21, 45, 75, 465, 1095, 2145, 4935, 14955, 80685, 229845, 1295325, 1575285, 9700575, 20435415, 15054105, 53999715, 2282745465
Offset: 0

Views

Author

Amarnath Murthy, Jul 17 2005

Keywords

Comments

It appears that 3 and 5 divide a(n) for n>4. Note that a(18)T. D. Noe, Jul 19 2005
Conjecture: a(n)==0 (mod 3) for n > 2. Then n-2^k is not == 0 (mod 3) and a prime is more probable. - Robert G. Wilson v, Jul 21 2005
Conjecture: a(n+15)==0 (mod 30) for n > 4. - Robert G. Wilson v, Jul 21 2005
a(n) > 10^10 for n >= 21. - Donovan Johnson, Jan 21 2009

Examples

			a(4) = 21, 21-2 =19, 21-4 = 17, 21-8 = 13, 21-16 = 5, 21 is the smallest number that gives four such primes.
		

Crossrefs

Cf. A109925.

Programs

  • Mathematica
    t=Table[cnt=0; r=1; While[rRobert G. Wilson v *)
  • Python
    from itertools import count
    from sympy import isprime
    def A109926(n):
        for m in count(1):
            c = 0
            for k in range(m.bit_length()):
                if isprime(m-(1<n:
                    break
            if c == n:
                return m # Chai Wah Wu, Feb 23 2025

Extensions

Edited, corrected and extended by T. D. Noe and Robert G. Wilson v, Jul 19 2005
a(20) from Donovan Johnson, Jan 21 2009

A175956 Numbers n such that A109925(n) = A109925(n+1).

Original entry on oeis.org

1, 6, 29, 41, 53, 59, 65, 89, 97, 126, 137, 148, 163, 179, 191, 192, 193, 223, 233, 239, 250, 252, 257, 269, 281, 307, 311, 330, 336, 359, 372, 389, 402, 419, 431, 457, 491, 504, 508, 521, 547, 557, 569, 598, 613, 641, 653, 659, 673, 683, 700, 719, 733, 739
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Oct 29 2010, Oct 31 2010

Keywords

Comments

(Number of primes of the form n-2^k) = (number of primes of the form n-2^k+1).

Examples

			a(2)=6 because A109925(6) = A109925(7) = 2.
		

Crossrefs

Programs

  • Magma
    a109925:=function(n); count:=0; e:=1; while e le n do if IsPrime(n-e) then count+:=1; end if; e*:=2; end while; return count; end function; S:=[]; a:=a109925(1); for n in [1..750] do b:=a109925(n+1); if a eq b then Append(~S, n); end if; a:=b; end for; S; // Klaus Brockhaus, Oct 30 2010
  • Maple
    A109925 := proc(n) a := 0 ; for k from 0 do p := n-2^k ; if p < 2 then return a; elif isprime(p) then a := a+1 ; end if; end do: end proc:
    isA175956 := proc(n) A109925(n) = A109925(n+1) ; end proc:
    for n from 1 to 1500 do if isA175956(n) then printf("%d,",n); end if; end do:
    # R. J. Mathar, Oct 30 2010
  • Mathematica
    SequencePosition[Table[Count[n-2^Range[0,Floor[Log2[n]]],?PrimeQ],{n,800}],{x,x_}][[;;,1]] (* Harvey P. Dale, Oct 21 2024 *)

Formula

A109925(a(n)) = A109925(a(n) + 1).

Extensions

More terms from Klaus Brockhaus and R. J. Mathar, Oct 30 2010

A006285 Odd numbers not of form p + 2^k (de Polignac numbers).

Original entry on oeis.org

1, 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, 1985, 2171, 2203, 2213, 2231, 2263, 2279, 2293, 2377, 2429, 2465, 2503, 2579, 2669
Offset: 1

Views

Author

Keywords

Comments

Contains both primes (A065381) and composites (A098237). - Jonathan Vos Post, Jun 19 2008
Crocker shows that this sequence is infinite; in particular, 2^2^n - 5 is in this sequence for each n > 2. - Charles R Greathouse IV, Sep 01 2015
Problem: what is the asymptotic density of de Polignac numbers? Based on the data in A254248, it seems this sequence may have an asymptotic density d > 0.05. Conjecture (cf. Pomerance 2013): the density d(n) of de Polignac numbers <= n is d(n) ~ (1 - 2/log(n))^(log(n)/log(2)), so the asymptotic density d = exp(-2/log(2)) = 0.055833... = 0.111666.../2. - Thomas Ordowski, Jan 30 2021
From Amiram Eldar, Feb 03 2021: (Start)
Romanov (or Romanoff) proved in 1934 that the complementary sequence has a positive lower asymptotic density, and the assumed asymptotic density was later named Romanov's constant (Pintz, 2006).
The lower asymptotic density of this sequence is positive (Van Der Corput, 1950; Erdős, 1950), and larger than 0.00905 (Habsieger and Roblot, 2006).
The upper asymptotic density of this sequence is smaller than 0.392352 (Elsholtz and Schlage-Puchta, 2018).
Previous bounds on the upper asymptotic density were given by Chen and Sun (2006), Pintz (2006), Habsieger and Roblot (2006), Lü (2007) and Habsieger and Sivak-Fischler (2010).
Romani (1983) conjectured that the asymptotic density of this sequence is 0.066... (End)
Chen, Dai, & Li show that the lower asymptotic density of this sequence is larger than 0.00965, improving on Habsieger & Roblot. - Charles R Greathouse IV, Jul 08 2024

Examples

			127 is in the sequence since 127 - 2^0 = 126, 127 - 2^1 = 125, 127 - 2^2 = 123, 127 - 2^3 = 119, 127 - 2^4 = 111, 127 - 2^5 = 95, and 127 - 2^6 = 63 are all composite. - _Michael B. Porter_, Aug 29 2016
		

References

  • Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See p. 226.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section F13.
  • Clifford A. Pickover, A Passion for Mathematics, John Wiley & Sons, Inc., NJ, 2005, pp. 62 & 300.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • J. G. Van Der Corput, On de Polignac's conjecture, Simon Stevin, Vol. 27 (1950), pp. 99-105.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, see #127.

Crossrefs

Programs

  • Haskell
    a006285 n = a006285_list !! (n-1)
    a006285_list = filter ((== 0) . a109925) [1, 3 ..]
    -- Reinhard Zumkeller, May 27 2015
    
  • Magma
    lst:=[]; for n in [1..1973 by 2] do x:=-1; repeat x+:=1; a:=n-2^x; until a lt 1 or IsPrime(a); if a lt 1 then Append(~lst, n); end if; end for; lst; // Arkadiusz Wesolowski, Aug 29 2016
    
  • Maple
    N:= 10000: # to get all terms <= N
    P:= select(isprime, {2,seq(i,i=3..N,2)}):
    T:= {seq(2^i,i=0..ilog2(N))}:
    R:= {seq(i,i=1..N,2)} minus {seq(seq(p+t,p=P),t=T)}:
    sort(convert(R,list)); # Robert Israel, Sep 23 2016
  • Mathematica
    Do[ i = 0; l = Ceiling[ N[ Log[ 2, n ] ] ]; While[ ! PrimeQ[ n - 2^i ] && i < l, i++ ]; If[ i == l, Print[ n ] ], {n, 1, 2000, 2} ]
    Join[{1},Select[Range[5,1999,2],!MemberQ[PrimeQ[#-2^Range[Floor[ Log[ 2,#]]]], True]&]] (* Harvey P. Dale, Jul 22 2011 *)
  • PARI
    isA006285(n,i=1)={ bittest(n,0) && until( isprime(n-i) || nn } \\ M. F. Hasler, Jun 19 2008, updated Apr 12 2017
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A006285_gen(startvalue=1): # generator of terms
        return filter(lambda n: not any(isprime(n-(1<A006285_list = list(islice(A006285_gen(),30)) # Chai Wah Wu, Nov 29 2023

Formula

A109925(a(n)) = 0. - Reinhard Zumkeller, May 27 2015
Conjecture: a(n) ~ n*exp(2/log(2)) = n*17.91... - Thomas Ordowski, Feb 02 2021

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 13 2000

A118955 Numbers of the form 2^k + prime.

Original entry on oeis.org

3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 27, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 45, 47, 48, 49, 51, 53, 54, 55, 57, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 79, 80, 81, 83, 84, 85, 87, 89, 90, 91, 93
Offset: 1

Views

Author

Reinhard Zumkeller, May 07 2006

Keywords

Comments

A109925(a(n)) > 0, complement of A118954;
The lower density is at least 0.09368 (Pintz) and upper density is at most 0.49095 (Habsieger & Roblot). The density, if it exists, is called Romanov's constant. Romani conjectures that it is around 0.434. - Charles R Greathouse IV, Mar 12 2008
Elsholtz & Schlage-Puchta improve the bound on lower density to 0.107648. Unpublished work by Jie Wu improves this to 0.110114, see Remark 1 in Elsholtz & Schlage-Puchta. - Charles R Greathouse IV, Aug 06 2021

References

  • Steven R. Finch, Mathematical Constants, Encyclopedia of Mathematics and its Applications, vol. 94, Cambridge University Press, 2003, Section 2.1, p. 87.

Crossrefs

Subsequence of A081311; A118957 is a subsequence.

Programs

  • Haskell
    a118955 n = a118955_list !! (n-1)
    a118955_list = filter f [1..] where
       f x = any (== 1) $ map (a010051 . (x -)) $ takeWhile (< x) a000079_list
    -- Reinhard Zumkeller, Jan 03 2014
    
  • Mathematica
    Select[Range[100], (For[r=False; k=1, #>k, k*=2, If[PrimeQ[#-k], r=True]]; r)& ] (* Jean-François Alcover, Dec 26 2013, after Charles R Greathouse IV *)
  • PARI
    is(n)=my(k=1);while(n>k,if(isprime(n-k),return(1),k*=2));0 \\ Charles R Greathouse IV, Mar 12 2008
    
  • PARI
    list(lim)=my(v=List(),t=1); while(tCharles R Greathouse IV, Aug 06 2021
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A118955_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n: any(isprime(n-(1<A118955_list = list(islice(A118955_gen(),30)) # Chai Wah Wu, Nov 29 2023

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

A078687 Number of x>=0 such that prime(n)-2^x is prime.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Dec 17 2002

Keywords

Examples

			prime(17)=59 and only 59-2^3 = 53 is prime hence a(17)=1
		

Crossrefs

Cf. A156695.

Programs

  • Mathematica
    f[p_] := Block[{c = exp = 0, lmt = 1 + Floor@ Log2@ p}, While[exp < lmt, If[ PrimeQ[p - 2^exp], c++]; exp++]; c]; Array[ f@ Prime@# &, 105] (* Robert G. Wilson v, Jul 07 2014 *)
  • PARI
    a(n)=sum(i=0,floor(log(prime(n))/log(2)),if(isprime(prime(n)-2^i),1,0))

Formula

a(A049084(A065381(n)))=0, a(A049084(A065380(n)))=1; A118953(n)<=a(n); a(n)=A109925(A000040(n)). - Reinhard Zumkeller, May 07 2006

A098237 Composite de Polignac numbers (A006285).

Original entry on oeis.org

905, 959, 1199, 1207, 1211, 1243, 1271, 1477, 1529, 1541, 1589, 1649, 1719, 1807, 1829, 1859, 1927, 1969, 1985, 2171, 2231, 2263, 2279, 2429, 2465, 2669, 2983, 2993, 3029, 3149, 3215, 3239, 3341, 3353, 3431, 3505, 3665, 3817, 3845, 3985
Offset: 1

Views

Author

Ralf Stephan, Aug 31 2004

Keywords

Comments

Odd composites that are not the sum of a prime and a power of two.

Crossrefs

Programs

  • Haskell
    a098237 n = a098237_list !! (n-1)
    a098237_list = filter ((== 0) . a109925) a071904_list
    -- Reinhard Zumkeller, May 27 2015

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)).

A282432 Number of primes of the form n - 3^k.

Original entry on oeis.org

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

Views

Author

Arkadiusz Wesolowski, Feb 15 2017

Keywords

Examples

			a(14) = 3; 14 - 3^0 = 13, 14 - 3 = 11, 14 - 3^2 = 5, three primes.
		

Crossrefs

Programs

  • Magma
    lst:=[]; for n in [1..105] do c:=0; e:=Floor(Log(3, n)); k:=0; while k le e do p:=n-3^k; if IsPrime(p) then c+:=1; end if; k+:=1; end while; Append(~lst, c); end for; lst;
    
  • Maple
    A282432 := proc(n)
        a := 0 ;
        for k from 0 do
            if n-3^k < 2 then
                return a ;
            elif isprime(n-3^k) then
                a := a+1 ;
            end if;
        end do:
    end proc:
    seq(A282432(n),n=1..80) ; # R. J. Mathar, Mar 07 2022
  • PARI
    ispp3(n) = (n==1) || (n==3) || (ispower(n,,&p) && (p==3));
    a(n) = {my(nb = 0); forprime(p=2, n, nb += ispp3(n-p);); nb;} \\ Michel Marcus, Feb 18 2017

Formula

a(A282430(n)) = 0.
G.f.: ( Sum_{i>=0} x^(3^i) ) * ( Sum_{j>=1} x^prime(j) ). - Ilya Gutkovskiy, Feb 10 2022

A350959 Number of ways to write 2*n+1 as 2^i (i >= 0) plus a prime.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 06 2022, answering a question from David W. Lewis

Keywords

Crossrefs

Formula

a(n) = A109925(2*n+1). - R. J. Mathar, Mar 07 2022
Showing 1-10 of 14 results. Next