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 13 results. Next

A046704 Additive primes: sum of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 113, 131, 137, 139, 151, 157, 173, 179, 191, 193, 197, 199, 223, 227, 229, 241, 263, 269, 281, 283, 311, 313, 317, 331, 337, 353, 359, 373, 379, 397, 401, 409, 421, 443, 449, 461, 463, 467, 487, 557, 571, 577, 593
Offset: 1

Views

Author

Keywords

Comments

Sum_{a(n) < x} 1/a(n) is asymptotic to (3/2)*log(log(log(x))) as x -> infinity; see Harman (2012). Thus the sequence is infinite. - Jonathan Sondow, Jun 07 2012
Harman 2012 also shows, under a conjecture about primes in short intervals, that there are 3/2 * x/(log x log log x) terms up to x. - Charles R Greathouse IV, Nov 17 2014

Examples

			The digit sums of 11 and 13 are 1+1=2 and 1+3=4. Since 2 is prime and 4 is not, 11 is a member and 13 is not. - _Jonathan Sondow_, Jun 07 2012
		

Crossrefs

Indices of additive primes are in A075177.
Cf. A046703, A119450 = Primes with odd digit sum, A081092 = Primes with prime binary digit sum, A104213 = Primes with nonprime digit sum.
Cf. A007953, A010051; intersection of A028834 and A000040.

Programs

  • Haskell
    a046704 n = a046704_list !! (n-1)
    a046704_list = filter ((== 1) . a010051 . a007953) a000040_list
    -- Reinhard Zumkeller, Nov 13 2011
  • Magma
    [ p: p in PrimesUpTo(600) | IsPrime(&+Intseq(p)) ];  // Bruno Berselli, Jul 08 2011
    
  • Maple
    select(n -> isprime(n) and isprime(convert(convert(n,base,10),`+`)), [2,seq(2*i+1,i=1..1000)]); # Robert Israel, Nov 17 2014
  • Mathematica
    Select[Prime[Range[100000]], PrimeQ[Apply[Plus, IntegerDigits[ # ]]]&]
  • PARI
    isA046704(n)={local(s,m);s=0;m=n;while(m>0,s=s+m%10;m=floor(m/10));isprime(n) & isprime(s)} \\ Michael B. Porter, Oct 18 2009
    
  • PARI
    is(n)=isprime(n) && isprime(sumdigits(n)) \\ Charles R Greathouse IV, Dec 26 2013
    

A027697 Odious primes: primes with odd number of 1's in binary expansion.

Original entry on oeis.org

2, 7, 11, 13, 19, 31, 37, 41, 47, 59, 61, 67, 73, 79, 97, 103, 107, 109, 127, 131, 137, 151, 157, 167, 173, 179, 181, 191, 193, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 313, 331, 367, 379, 397, 409, 419, 421, 431, 433, 439, 443, 457, 463, 487, 491, 499, 521, 541, 557, 563
Offset: 1

Views

Author

Keywords

Comments

Conjecture: a(n) < A027699(n) except for n = 2; verified up to n=5*10^7. Moreover, I conjecture that A027699(n) - a(n) tends to infinity. - Vladimir Shevelev

Crossrefs

Cf. A000069 (odious numbers), A092246 (odd odious numbers)

Programs

  • Maple
    a:=proc(n) local nn: nn:= convert(ithprime(n), base, 2): if `mod`(sum(nn[j], j =1..nops(nn)), 2)=1 then ithprime(n) else end if end proc: seq(a(n),n=1..103); # Emeric Deutsch, Oct 24 2007
  • Mathematica
    Clear[BinSumOddQ];BinSumOddQ[a_]:=Module[{i,s=0},s=0;For[i=1,i<=Length[IntegerDigits[a,2]],s+=Extract[IntegerDigits[a,2],i];i++ ];OddQ[s]]; lst={};Do[p=Prime[n];If[BinSumOddQ[p],AppendTo[lst,p]],{n,4!}];lst (* Vladimir Joseph Stephan Orlovsky, Apr 06 2009 *)
    Select[Prime@ Range@ 120, OddQ@ First@ DigitCount[#, 2] &] (* Michael De Vlieger, Feb 08 2016 *)
  • PARI
    f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==1,s++));return(s%2)};
    forprime(p=2, 563, if(f(p), print1(p,", "))) \\ Washington Bomfim, Jan 14 2011
    
  • PARI
    s=[]; forprime(p=2, 1000, if(norml2(binary(p))%2==1, s=concat(s, p))); s \\ Colin Barker, Feb 18 2014
    
  • Python
    from sympy import primerange
    print([n for n in primerange(1, 1001) if bin(n)[2:].count("1")%2]) # Indranil Ghosh, May 03 2017

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A119480 Numbers n such that the Bernoulli number B_{4n} has denominator 30.

Original entry on oeis.org

1, 2, 17, 19, 31, 38, 47, 59, 61, 62, 71, 94, 101, 103, 107, 109, 118, 122, 137, 149, 151, 157, 167, 181, 197, 206, 211, 218, 223, 227, 229, 241, 257, 263, 269, 271, 283, 289, 302, 311, 313, 314, 317, 331, 334, 337, 347, 349, 353, 361, 362, 367, 379
Offset: 1

Views

Author

Alexander Adamchuk, Jul 26 2006

Keywords

Comments

Most a(n) are primes from A043297(n) except for a(1) = 1 and composite a(n) for n=6,10,12,17,18,26,28,38,39,42,45,50,51, ... a(6) = 38 = 2*19, a(10) = 62 = 2*31, a(12) = 94 = 2*47, a(17) = 118 = 2*59, a(18) = 122 = 2*61, a(26) = 206 = 2*103, a(28) = 218 = 2*109, a(38) = 289 = 17*17, a(39) = 302 = 2*151, a(42) = 314 = 2*157, a(45) = 334 = 2*167, a(50) = 361 = 19*19, a(51) = 362 = 2*181, ... It appears that most composite a(n) are the doubles of some primes from A043297(n) belonging to A081092[n] and A045404[n] - Primes congruent to {3, 4, 5, 6} mod 7. The rest of composite a(n) are the squares of the primes from A043297(n).
Some a(n) are the products of different primes from A043297(n), for example a(77) = 527 = 17*31. a(n) belong to A045402 Primes congruent to {1, 3, 4, 5, 6} mod 7. a(n) is a subset of A053176 Primes p such that 2p+1 is composite, A045979 Bernoulli number B_{2n} has denominator 6, A090863 Numbers n such that F(n+1)*F(n-1)*B(2n) is an integer, where F(k)=k-th Fibonacci number and B(2k)=2k-th Bernoulli number. - Alexander Adamchuk, Jul 27 2006

Crossrefs

Programs

  • Mathematica
    Select[Range@ 400, Denominator@ BernoulliB[4 #] == 30 &] (* Michael De Vlieger, Aug 09 2017 *)

Formula

a(n) = A051225[n]/2.

A052294 Pernicious numbers: numbers with a prime number of 1's in their binary expansion.

Original entry on oeis.org

3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 31, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 47, 48, 49, 50, 52, 55, 56, 59, 61, 62, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 79, 80, 81, 82, 84, 87, 88, 91, 93, 94, 96, 97, 98, 100
Offset: 1

Views

Author

Jeremy Gow (jeremygo(AT)dai.ed.ac.uk), Feb 08 2000

Keywords

Comments

No power of 2 is pernicious, but 2^n+1 always is.
If a prime p is of the form 2^k -1, then p is included in this sequence. - Leroy Quet, Sep 20 2008
There are A121497(n) n-bit members of this sequence. - Charles R Greathouse IV, Mar 22 2013
A list of programming codes for pernicious numbers can be found in the Rosetta Code link. - Martin Ettl, May 27 2014

Examples

			26 is in the sequence because the binary expansion of 26 is 11010 and 11010 has three 1's and 3 is prime, so the number of 1's in the binary expansion of 26 is prime. - _Omar E. Pol_, Apr 04 2016
		

Crossrefs

Cf. A262481 (subsequence).

Programs

  • Haskell
    a052294 n = a052294_list !! (n-1)
    a052294_list = filter ((== 1) . a010051 . a000120) [1..]
    -- Reinhard Zumkeller, Nov 16 2012
    
  • Maple
    filter:= n -> isprime(convert(convert(n,base,2),`+`)):
    select(filter, [$1..1000]); # Robert Israel, Oct 19 2014
  • Mathematica
    Select[Range[6! ],PrimeQ[DigitCount[ #,2][[1]]]&] (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)
  • PARI
    is(n)=isprime(hammingweight(n)) \\ Charles R Greathouse IV, Mar 22 2013
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(bin(n).count("1"))
    print([k for k in range(101) if ok(k)]) # Michael S. Branicky, Jun 16 2022
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(n.bit_count())
    print([k for k in range(101) if ok(k)]) # Michael S. Branicky, Dec 27 2023

A081091 Primes of the form 2^i + 2^j + 1, i > j > 0.

Original entry on oeis.org

7, 11, 13, 19, 37, 41, 67, 73, 97, 131, 137, 193, 521, 577, 641, 769, 1033, 1153, 2053, 2081, 2113, 4099, 4129, 8209, 12289, 16417, 18433, 32771, 32801, 32833, 40961, 65539, 133121, 147457, 163841, 262147, 262153, 262657, 270337, 524353, 524801
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 05 2003

Keywords

Comments

This is sequence A070739 without the Fermat primes, A000215. Sequence A081504 lists the i for which there are no primes. - T. D. Noe, Jun 22 2007
Primes in A014311. - Reinhard Zumkeller, May 03 2012

Examples

			    7 = 2^2 + 2^1 + 1
   11 = 2^3 + 2^1 + 1
   13 = 2^3 + 2^2 + 1
   19 = 2^4 + 2^1 + 1
   37 = 2^5 + 2^2 + 1
   41 = 2^5 + 2^3 + 1
   67 = 2^6 + 2^1 + 1
   73 = 2^6 + 2^3 + 1
   97 = 2^6 + 2^5 + 1
  131 = 2^7 + 2^1 + 1
  137 = 2^7 + 2^3 + 1
  193 = 2^7 + 2^6 + 1
  521 = 2^9 + 2^3 + 1
		

Crossrefs

Essentially the same as A070739.
Cf. A095077 (primes with four bits set).
A057733 = 2^A057732 + 3 and A039687 = 3*2^A002253 + 1 are subsequences.

Programs

  • Haskell
    a081091 n = a081091_list !! (n-1)
    a081091_list = filter ((== 1) . a010051') a014311_list
    -- Reinhard Zumkeller, May 03 2012
    
  • Maple
    N:= 20: # to get all terms < 2^N
    select(isprime, [seq(seq(2^i+2^j+1,j=1..i-1),i=1..N-1)]); # Robert Israel, May 17 2016
  • Mathematica
    Select[Flatten[Table[2^i + 2^j + 1, {i, 21}, {j, i-1}]], PrimeQ] (* Alonso del Arte, Jan 11 2011 *)
  • PARI
    do(mx)=my(v=List(),t); for(i=2,mx,for(j=1,i-1,if(ispseudoprime(t=2^i+2^j+1), listput(v,t)))); Vec(v) \\ Charles R Greathouse IV, Jan 02 2014
    
  • PARI
    is(n)=hammingweight(n)==3 && isprime(n) \\ Charles R Greathouse IV, Aug 28 2017
    
  • PARI
    A81091=[7]; next_A081091(p, i=exponent(p), j=exponent(p-2^i))=!until(isprime(2^i+2^j+1), j++>=i && i++ && j=1)+2^i+2^j
    A081091(n)={for(k=#A81091, n-1, A81091=concat(A81091, next_A081091(A81091[k]))); A81091[n]} \\ M. F. Hasler, Mar 03 2023
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A081091_gen(): # generator of terms
        return filter(isprime,map(lambda s:int('1'+''.join(s)+'1',2),(s for l in count(1) for s in multiset_permutations('0'*(l-1)+'1'))))
    A081091_list = list(islice(A081091_gen(),30)) # Chai Wah Wu, Jul 19 2022

Formula

A000120(a(n)) = 3.

A081504 Numbers n such that there are no primes of the form 2^n+2^i+1 for 0

Original entry on oeis.org

8, 25, 32, 40, 43, 48, 56, 58, 64, 96, 104, 112, 120, 128, 134, 140, 145, 152, 160, 176, 185, 192, 208, 212, 224, 235, 240, 244, 248, 252, 256, 264, 272, 280, 286, 288, 292, 302, 304, 308, 320, 326, 332, 348, 356, 360, 384, 392, 394, 400, 416, 418, 432, 448
Offset: 1

Views

Author

Ralf Stephan, Apr 21 2003

Keywords

Comments

There seem to be no such numbers (bit sizes) such that any 4-bit or 5-bit number is composite, up to n around 200.

Crossrefs

Programs

  • PARI
    for(n=2, 1000, f=0; for(i=1, n-1, t=2^n+2^i+1;  if(isprime(t), f=1; break)); if(!f, print1(n", ")))

A144214 Primes with both a prime number of 0's and a prime number of 1's in their binary representations.

Original entry on oeis.org

17, 19, 37, 41, 79, 103, 107, 109, 131, 137, 151, 157, 167, 173, 179, 181, 193, 199, 211, 227, 229, 233, 241, 257, 367, 379, 431, 439, 443, 463, 487, 491, 499, 521, 541, 557, 563, 569, 577, 587, 601, 607, 613, 617, 631, 641, 647, 653, 659, 661, 677, 701, 709
Offset: 1

Views

Author

Leroy Quet, Sep 14 2008

Keywords

Examples

			79, a prime, in binary is 1001111. This has two 0's and has five 1's. Since both two and five are primes, 79 is included in the sequence.
		

Crossrefs

Programs

  • Maple
    A080791 := proc(n) local i,dgs ; dgs := convert(n,base,2) ; nops(dgs)-add(i,i=dgs) ; end: A000120 := proc(n) local i,dgs ; dgs := convert(n,base,2) ; add(i,i=dgs) ; end: isA144214 := proc(n) local no0,no1 ; no0 := A080791(n) ; no1 := A000120(n) ; isprime(n) and isprime(no0) and isprime(no1) ; end: for n from 1 to 1200 do if isA144214(n) then printf("%d,",n) ; fi; od: # R. J. Mathar, Sep 17 2008
  • Mathematica
    Select[Prime[Range[6! ]],PrimeQ[DigitCount[ #,2,0]]&&PrimeQ[DigitCount[ #,2,1]]&] (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)
  • Python
    from sympy import isprime
    def ok(n): return isprime(c:=n.bit_count()) and isprime(n.bit_length()-c) and isprime(n)
    print([k for k in range(710) if ok(k)]) # Michael S. Branicky, Dec 27 2023

Extensions

More terms from R. J. Mathar, Sep 17 2008

A081093 a(n) is the smallest prime such that the number of 1's in its binary expansion is equal to the n-th prime.

Original entry on oeis.org

3, 7, 31, 127, 3583, 8191, 131071, 524287, 14680063, 1073479679, 2147483647, 266287972351, 4260607557631, 17591112302591, 246290604621823, 17996806323437567, 1152917106560335871, 2305843009213693951
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 05 2003

Keywords

Comments

a(n) = Min{p: A000120(p)=A000040(n), p prime}.
If 2^(Prime[n]) - 1 is a prime number, then a(n) = 2^(Prime[n]) - 1, where Prime[n] denotes the n-th prime number. This means that every Mersenne prime arises in this sequence. - Stefan Steinerberger, Jan 22 2006
For all n with prime(n) < 300, a(n) has either prime(n) or prime(n)+1 bits. - David Wasserman, Oct 25 2006

Examples

			n=4, p[4]=11, 3583=[11011111111] has 11 digits=1 and is prime;
2047=23.89=[11111111111] is not here because it is composite.
a(5)=3583=A081092(266)=A000040(502) having eleven 1's: '110111111111' and A000120(p)<11=prime(5) for primes p<3583.
Mersenne-primes are here, Mersenne composites not.
		

Crossrefs

Programs

  • Mathematica
    Do[k=1;While[Count[IntegerDigits[Prime[k], 2], 1] !=Prime[n], k++ ];Print[Prime[k]], {n, 1, 10}]

Formula

a(n) = A061712(A000040(n)). - Franklin T. Adams-Watters, Jun 06 2006

Extensions

More terms from Franklin T. Adams-Watters, Jun 06 2006
Further terms from David Wasserman, Oct 25 2006
Edited by N. J. A. Sloane, Sep 15 2008 at the suggestion of R. J. Mathar

A085448 Primes having a semiprime number of 1's in their binary representation.

Original entry on oeis.org

23, 29, 43, 53, 71, 83, 89, 101, 113, 139, 149, 163, 197, 263, 269, 277, 281, 293, 311, 317, 337, 347, 349, 353, 359, 373, 389, 401, 449, 461, 467, 523, 547, 571, 593, 599, 619, 643, 673, 683, 691, 739, 773, 797, 811, 821, 839, 853, 857, 881, 907, 937, 977
Offset: 1

Views

Author

Jason Earls, Aug 14 2003

Keywords

Comments

Sequence of least prime with the number of 1's in its binary representation equal to n-th semiprime is: 23,311,991,2039,73727,63487,4128767,... What is the prime corresponding to 22?

Examples

			The prime 43 = '101011' has four 1's and so is a term.
		

Crossrefs

Programs

  • Mathematica
    seqQ[n_] := PrimeQ[n] && PrimeOmega[DigitCount[n, 2, 1]] == 2; Select[Range[1000], seqQ] (* Amiram Eldar, Dec 14 2019 *)

A144213 Primes with a prime number of 0's in their binary representations.

Original entry on oeis.org

17, 19, 37, 41, 43, 53, 71, 79, 83, 89, 101, 103, 107, 109, 113, 131, 137, 151, 157, 167, 173, 179, 181, 193, 199, 211, 227, 229, 233, 241, 257, 263, 269, 277, 281, 293, 311, 317, 337, 347, 349, 353, 359, 367, 373, 379, 389, 401, 431, 439, 443, 449, 461, 463
Offset: 1

Views

Author

Leroy Quet, Sep 14 2008

Keywords

Examples

			41, a prime, in binary is 101001. This has three 0's and 3 is prime, so 41 is in the sequence.
		

Crossrefs

Cf. A081092, A144214. Intersection of A000040 and A144754.

Programs

  • Maple
    A080791 := proc(n) local i,dgs ; dgs := convert(n,base,2) ; nops(dgs)-add(i,i=dgs) ; end: isA144213 := proc(n) local no0 ; no0 := A080791(n) ; if isprime(n) and isprime(no0) then true ; else false; fi; end: for n from 1 to 1200 do if isA144213(n) then printf("%d,",n) ; fi; od: # R. J. Mathar, Sep 17 2008
    # second Maple program:
    q:= n-> isprime(n) and isprime(add(1-i, i=Bits[Split](n))):
    select(q, [$1..500])[];  # Alois P. Heinz, Dec 27 2023
  • Mathematica
    nmax = 100;
    Select[Prime[Range[nmax]],
    PrimeQ[Total@Mod[1 + IntegerDigits[#, 2], 2]] &] (* Andres Cicuttin, Jul 08 2020 *)
    Select[Prime[Range[100]],PrimeQ[DigitCount[#,2,0]]&] (* Harvey P. Dale, Feb 03 2021 *)
  • Python
    from sympy import isprime
    def ok(n): return isprime(n.bit_length()-n.bit_count()) and isprime(n)
    print([k for k in range(464) if ok(k)]) # Michael S. Branicky, Dec 27 2023

Extensions

More terms from R. J. Mathar, Sep 17 2008
Showing 1-10 of 13 results. Next