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.

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

A052467 Binomial transform of {b(n)}, where b(n)=1 for prime n and b(n)=0 otherwise.

Original entry on oeis.org

0, 1, 3, 6, 11, 20, 37, 70, 134, 255, 476, 869, 1564, 2821, 5201, 9948, 19793, 40562, 84271, 174952, 359576, 728805, 1457402, 2885051, 5681277, 11185110, 22103926, 43939533, 87864092, 176447165, 354929146, 713198803, 1428312446, 2846268351
Offset: 1

Views

Author

Keywords

Comments

Number of compositions of n into a prime number of parts. - Vladeta Jovovic, Jan 31 2005
The number of pernicious numbers (A052294) between 2^(n-1) and 2^n. Although the graph looks almost like 2^n, the graph of a(n)/2^n has quite a bit of variation. - T. D. Noe, Mar 14 2009

Crossrefs

Programs

  • Mathematica
    b[n_] := Boole[ PrimeQ[n]]; a[n_] := Sum[ Binomial[n, k]*b[k], {k, 0, n}]; Table[a[n], {n, 0, 34}] // Differences (* Jean-François Alcover, Oct 25 2012 *)

Formula

G.f.: Sum_{k>=1} (x/(1 - x))^prime(k). - Ilya Gutkovskiy, Dec 28 2016
a(n) = A121497(n+1) - A121497(n). - Wesley Ivan Hurt, Jan 14 2022

Extensions

More terms from David Wasserman, Feb 25 2002
Description corrected by T. D. Noe, May 17 2003

A178851 The number of length n sequences on {0,1,2}(ternary sequences) that contain a prime number of 2's.

Original entry on oeis.org

0, 0, 1, 7, 32, 121, 412, 1317, 4048, 12144, 35904, 105249, 306968, 892217, 2585468, 7468532, 21500800, 61688513, 176477988, 503906221, 1438235592, 4110846808, 11789919200, 33991337521, 98657320240, 288505634480, 850146795840, 2522918119392, 7531922736384
Offset: 0

Views

Author

Geoffrey Critzer, Dec 27 2010

Keywords

Comments

a(n) is the number of positive integers less than 3^n that when expressed as a ternary numeral contain a prime number of 2's.
a(n)/3^n is the probability that a series of Bernoulli trials with probability of success equal to 1/3 will result in a prime number of successes. Cf. A121497

Examples

			a(3)=7 because 8,17,20,23,24,25,26 have a prime number of 2's in their ternary notation.
		

Programs

  • Mathematica
    P=Table[Prime[m],{m,1,200}];Range[0,20]! CoefficientList[Series[Exp[2x] Sum[x^p/p!,{p,P}],{x,0,20}],x]

Formula

E.g.f.:exp(2x)*(x^2/2!+x^3/3!+x^5/5!+...)
a(n) = Sum Binomial(n,p)*2^(n-p) where the sum is taken over the prime numbers.

A334038 a(n) = Product_{p<=n, p prime} binomial(n,p).

Original entry on oeis.org

1, 1, 1, 3, 24, 100, 1800, 15435, 702464, 13716864, 163296000, 1383574500, 109294479360, 3842829083808, 1159801183597056, 132320316074821875, 8213884352593920000, 327816138093181337600, 167079259535068179726336, 34044607357920579594754944
Offset: 0

Views

Author

Om R. Patel, Apr 13 2020

Keywords

Examples

			For n=2, p=2: a(n) = C(2,2) = 1.
For n=3, p=2,3: a(n) = C(3,2) * C(3,3) = 3.
For n=4, p=2,3: a(n) = C(4,2) * C(4,3) = 24.
		

Crossrefs

Programs

  • Maple
    a:= n-> mul(`if`(isprime(p), binomial(n, p), 1), p=2..n):
    seq(a(n), n=0..20);  # Alois P. Heinz, Apr 13 2020
  • PARI
    a(n) = prod(k=1, n, if (isprime(k), binomial(n, k), 1)); \\ Michel Marcus, Apr 13 2020
    
  • PARI
    a(n)=my(s); forprime(p=2,n, s*=binomial(n,p)); s \\ Charles R Greathouse IV, Apr 13 2020
Showing 1-4 of 4 results.