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-8 of 8 results.

A035100 Number of bits in binary expansion of n-th prime.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    Digits := 40: [ seq(1+floor(evalf(log(ithprime(n))/log(2))), n=1..100) ];
  • Mathematica
    f[n_]:=Length[IntegerDigits[Prime[n],2]]; Table[f[n],{n,5!}] (* Vladimir Joseph Stephan Orlovsky, Feb 07 2010 *)
    IntegerLength[Prime[Range[100]],2] (* Harvey P. Dale, Nov 10 2022 *)
  • PARI
    a(n)=#binary(prime(n)) \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    from sympy import prime
    def A035100(n): return prime(n).bit_length() # Chai Wah Wu, Nov 19 2024

A077643 Number of squarefree integers in closed interval [2^n, -1 + 2*2^n], i.e., among 2^n consecutive numbers beginning with 2^n.

Original entry on oeis.org

1, 2, 3, 5, 9, 19, 39, 79, 157, 310, 621, 1246, 2491, 4980, 9958, 19924, 39844, 79672, 159365, 318736, 637457, 1274916, 2549816, 5099651, 10199363, 20398663, 40797299, 81594571, 163189087, 326378438, 652756861, 1305513511, 2611026987, 5222053970, 10444108084
Offset: 0

Views

Author

Labos Elemer, Nov 14 2002

Keywords

Comments

Number of squarefree numbers with binary expansion of length n, or with n bits. The sum of these numbers is given by A373123. - Gus Wiseman, Jun 02 2024

Examples

			For n=4: among the 16 numbers of {16, ..., 31}, nine are squarefree [17, 19, 21, 22, 23, 26, 29, 30, 31], so a(4) = 9.
		

Crossrefs

Partial sums (except first term) are A143658.
Run-lengths of A372475.
The minimum is A372683, delta A373125, indices A372540.
The maximum is A372889 (except at n=1), delta A373126, indices A143658.
Row-sums are A373123.
A005117 lists squarefree numbers, first differences A076259.
A053797 gives nonempty lengths of exclusive gaps between squarefree numbers.
A029837 counts bits, row-lengths of A030190 and A030308.
For primes between powers of 2:
- sum A293697
- length A036378 or A162145
- min A104080 or A014210, delta A092131, indices A372684
- max A014234, delta A013603, indices A007053
For squarefree numbers between primes:
- sum A373197
- length A373198 = A061398 - 1
- min A000040
- max A112925 (delta A240473), opposite A112926 (delta A240474)
Cf. A010036, A029931, A035100, A049093-A049096, A372473 (firsts of A372472), A372541 (firsts of A372433).

Programs

  • Mathematica
    Table[Apply[Plus, Table[Abs[MoebiusMu[2^w+j]], {j, 0, 2^w-1}]], {w, 0, 15}]
    (* second program *)
    Length/@Split[IntegerLength[Select[Range[10000],SquareFreeQ],2]]//Most (* Gus Wiseman, Jun 02 2024 *)
  • PARI
    { a(n) = sum(m=1,sqrtint(2^(n+1)-1), moebius(m) * ((2^(n+1)-1)\m^2 - (2^n-1)\m^2) ) } \\ Max Alekseyev, Oct 18 2008

Formula

a(n) = Sum_{j=0..-1+2^n} abs(mu(2^n + j)).
a(n)/2^n approaches 1/zeta(2), so limiting sequence is floor(2^n/zeta(2)), n >= 0. - Wouter Meeussen, May 25 2003

Extensions

More terms from Mark Hudson (mrmarkhudson(AT)hotmail.com), Feb 12 2003
More terms from Wouter Meeussen, May 25 2003
a(25)-a(32) from Max Alekseyev, Oct 18 2008
a(33)-a(34) from Amiram Eldar, Jul 17 2024

A346730 Irregular triangle read by rows: T(n,k) is the number of n-bit numbers with k divisors.

Original entry on oeis.org

1, 0, 2, 0, 2, 1, 1, 0, 2, 1, 4, 0, 1, 0, 5, 1, 4, 1, 3, 0, 2, 0, 7, 1, 11, 0, 6, 0, 4, 1, 1, 0, 1, 0, 13, 1, 20, 1, 9, 1, 9, 1, 2, 0, 6, 0, 0, 0, 1, 0, 23, 1, 39, 0, 15, 0, 25, 2, 3, 0, 12, 0, 1, 1, 3, 0, 2, 0, 1, 0, 43, 2, 74, 0, 27, 0, 48, 3, 6, 0, 25, 0, 2, 2, 13, 0, 5, 0, 2, 0, 0, 0, 4
Offset: 1

Views

Author

Jon E. Schoenfield, Jul 30 2021

Keywords

Comments

The number of terms in row n is A346729(n).

Examples

			There are four 3-bit numbers: 4 = 100_2, 5 = 101_2 = 5, 6 = 110_2, 7 = 111_2. 5 and 7 are both prime, so each has 2 divisors; 4 = 2^2 has 3 divisors (1, 2, and 4), and 6 = 2*3 has 4 divisors (1, 2, 3, and 6). Thus, among the 3-bit numbers, the counts of those having 1, 2, 3, and 4 divisors are 0, 2, 1, and 1, respectively, so the 3rd row of the table is 0, 2, 1, 1.
Triangle begins:
  1;
  0,  2;
  0,  2, 1,  1;
  0,  2, 1,  4, 0, 1;
  0,  5, 1,  4, 1, 3, 0, 2;
  0,  7, 1, 11, 0, 6, 0, 4, 1, 1, 0, 1;
  0, 13, 1, 20, 1, 9, 1, 9, 1, 2, 0, 6, 0, 0, 0, 1;
		

Crossrefs

Row sums give A011782.
Columns k=1-2 give: A063524, A162145 (for n>=2).

Programs

  • Maple
    T:= n-> (p-> seq(coeff(p, x, i), i=1..degree(p)))(add
            (x^numtheory[tau](i), i=2^(n-1)..2^n-1)):
    seq(T(n), n=1..10);  # Alois P. Heinz, Jul 31 2021
  • Mathematica
    Map[BinCounts[#, {0, Max[#] + 1, 1}] &, Table[DivisorSigma[0, 2^n + k], {n, 0, 8}, {k, 0, 2^n - 1}]] // Flatten (* Michael De Vlieger, Aug 29 2021 *)

Formula

T(n,2) = A162145(n) for n > 1.
T(n,n) = A300509(n).
Sum_{k>=1} k * T(n,k) = A153876(n). - Alois P. Heinz, Aug 01 2021

A162146 a(n) = the smallest positive integer divisible by exactly n distinct primes, where each of these primes has the same number of digits when written in binary.

Original entry on oeis.org

1, 2, 6, 7429, 215441, 6678671, 9586934839, 584803025179, 1985383050388741, 204494454190040323, 21880906598334314561, 2385018819218440287149, 269507126571683752447837, 34227405074603836560875299
Offset: 0

Views

Author

Leroy Quet, Jun 25 2009

Keywords

Comments

Each term of this sequence is squarefree.

Examples

			For a(2), 6 = 2 (10_b) * 3 (11_b), For a(3), 7429 = 17 (10001_b) * 19 (10011_b) * 23 (10111_b), For a(4), 215441 = 17 (10001_b) * 19 (10011_b) * 23 (10111_b) * 29 (11101_b), etc. - _Robert G. Wilson v_, Aug 16 2009
		

Crossrefs

Cf. A162145.

Programs

  • Mathematica
    f[n_] := Block[{k = 1}, While[p = Select[ Table[i, {i, 2^k, 2^(k + 1) - 1}], PrimeQ@# &]; len = Length@p; len < n, k++ ]; Times @@ Take[p, n]]; Table[ f@n, {n, 0, 15}] (* Robert G. Wilson v, Aug 16 2009 *)

Extensions

More terms from Robert G. Wilson v, Aug 16 2009

A233919 a(n) is the number of noncomposites (primes or 1) that are n digits long in balanced ternary notation.

Original entry on oeis.org

1, 2, 4, 6, 18, 42, 111, 279, 752, 1990, 5376, 14707, 40465, 111970, 311997, 873239, 2455818, 6933060, 19640273, 55813426, 159047591, 454373344, 1301016216, 3733009232, 10731465131, 30904208376, 89140202911, 257498974953, 744861243809, 2157405104355
Offset: 1

Views

Author

Lei Zhou, Dec 17 2013

Keywords

Crossrefs

Programs

  • Mathematica
    BTSeg[d_Integer] := Module[{}, {3^d - (3^d - 1)/2, 3^d + (3^d - 1)/2}];
    Table[s = BTSeg[d]; PrimePi[Ceiling[s[[2]]/2]*2] - PrimePi[s[[1]] - 1], {d, 0, 29}]

A246807 Number of n-bit numbers that can be written as the concatenation of 0 or more prime numbers (everything written in base 2).

Original entry on oeis.org

1, 0, 2, 2, 5, 8, 15, 33, 59, 126, 246, 494, 978, 1971, 3930, 7845, 15749, 31527, 63349, 126986, 254880, 511468, 1026348, 2060633, 4135808, 8303940, 16669925, 33472231, 67201664, 134930088, 270895845, 543915707, 1091923726, 2192302476, 4400938402, 8835035284
Offset: 0

Views

Author

Jeffrey Shallit, Nov 16 2014

Keywords

Comments

Here we only consider canonical base-2 expansions (with no leading zeros). 1 is not a prime, and neither is 0.

Examples

			For n = 5 the 8 solutions counted include the primes {17,19,23,29,31} between 16 and 31, and also the numbers 21 (10.101), 22 (101.10), and 30 (111.10).
		

Crossrefs

Programs

  • Python
    from sympy import isprime, primerange
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def ok(n):
      if n%4 == 0: return False
      if isprime(n): return True
      b = bin(n)[2:]
      for i in range(2, len(b)-1):
        if b[i] != '0' and isprime(int(b[:i], 2)) and ok(int(b[i:], 2)):
          return True
      return False
    def a(n):
      return 1 if n == 0 else sum(1 for m in range(2**(n-1), 2**n) if ok(m))
    print([a(n) for n in range(21)]) # Michael S. Branicky, Mar 26 2021

Extensions

More terms from Jeffrey Shallit, Nov 25 2014
a(29)-a(32) from Michael S. Branicky, Mar 26 2021
a(33)-a(35) from Jinyuan Wang, May 31 2025

A351380 Table read by rows: T(n,k) is the number of integers in the interval [2^(n-1), 2^n - 1] that have the k-th least prime signature.

Original entry on oeis.org

1, 0, 2, 0, 2, 1, 1, 0, 2, 1, 3, 1, 1, 0, 5, 1, 3, 1, 3, 1, 1, 1, 0, 7, 1, 11, 0, 5, 0, 3, 1, 1, 1, 1, 1, 0, 13, 1, 19, 1, 9, 1, 2, 7, 0, 1, 2, 3, 1, 2, 1, 1, 0, 23, 1, 39, 0, 14, 0, 8, 16, 1, 2, 3, 9, 0, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 0, 43, 2, 73, 1, 27, 0, 11, 37, 0, 2, 6, 20, 0, 2, 3, 8, 0, 2, 4, 2, 4, 0, 1, 1, 1, 2, 1, 1, 1, 1
Offset: 1

Views

Author

Jon E. Schoenfield, Feb 09 2022

Keywords

Comments

In rows n = 4 and n = 6..19, T(n,4) is the largest term in the row, i.e., squarefree semiprimes (A006881) outnumber the integers of each of the other prime signatures, but T(20,4) = 106408 < 109245 = T(20,9): among 20-bit numbers, sphenic numbers (A007304) (i.e., products of three distinct primes) are more numerous than squarefree semiprimes.

Examples

			The first 7 rows are shown in the body of the table below. Across the top of the table are the terms of A025487, whose k-th term is the smallest integer having the k-th prime signature.
.
  A025487(k)| 1  2  4  6  8 12 16 24 30 32 36 48 60 64 72 96 120 ...
  ----------+-------------------------------------------------------
         n\k| 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17  ...
  ----------+-------------------------------------------------------
         1  | 1
         2  | 0  2
         3  | 0  2  1  1
         4  | 0  2  1  3  1  1
         5  | 0  5  1  3  1  3  1  1  1
         6  | 0  7  1 11  0  5  0  3  1  1  1  1  1
         7  | 0 13  1 19  1  9  1  2  7  0  1  2  3  1  2  1  1
.
E.g., the 9 terms in row n=5 are 0, 5, 1, 3, 1, 3, 1, 1, 1 because, of the 16 integers in the interval [2^(5-1), 2^5 - 1] = [16, 31]:
  - 0 have prime signature 1 (since all are > 1)
  - 5 are primes
  - 1 is the square of a prime
  - 3 are squarefree semiprimes
etc., as shown below (where p, q, and r represent distinct primes):
.
.                  prime     OEIS
  k  A025487(k)  signature  Annnnnn  integers in [16, 31]  T(5,k)
  -  ----------  ---------  -------  --------------------  ------
  1       1          1         -            (none)            0
  2       2          p      A000040   17, 19, 23, 29, 31      5
  3       4         p^2     A001248           25              1
  4       6        p * q    A006881       21, 22, 26          3
  5       8         p^3     A030078           27              1
  6      12       p^2 * q   A054753       18, 20, 28          3
  7      16         p^4     A030514           16              1
  8      24       p^3 * q   A065036           24              1
  9      30      p * q * r  A007304           30              1
		

Crossrefs

Formula

Sum_{k>=1} T(n,k) = 2^n.
T(n,2) = A162145(n) for n > 1.

A374403 Number of n-bit primes.

Original entry on oeis.org

0, 2, 2, 2, 5, 7, 13, 23, 43, 75, 137, 255, 464, 872, 1612, 3030, 5709, 10749, 20390, 38635, 73586, 140336, 268216, 513708, 985818, 1894120, 3645744, 7027290, 13561907, 26207278, 50697537, 98182656, 190335585, 369323305, 717267168, 1394192236, 2712103833, 5279763824
Offset: 1

Views

Author

Jon E. Schoenfield, Jul 07 2024

Keywords

Comments

Number of primes whose binary expansion is n digits long.
a(n) is the number of primes in the half-open interval [2^(n-1), 2^n).
First differences of A185192.
See A007053 for additional information.

Examples

			a(1) = 0 because neither 0 nor 1 is a prime.
a(2) = 2 because the 2-bit primes are 10_2 = 2 and 11_2 = 3.
a(4) = 2 because the 4-bit primes are 1011_2 = 11 and 1101_2 = 13.
		

Crossrefs

Essentially the same as A036378 and A162145.
Cf. A185192 (partial sums).

Programs

  • Mathematica
    a[n_]:=Sum[Boole[PrimeQ[i]],{i,2^(n-1),2^n-1}]; Array[a,38] (* Stefano Spezia, Jul 07 2024 *)

Formula

a(n) = A162145(n) for n >= 2. - Amiram Eldar, Jul 08 2024
Showing 1-8 of 8 results.