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 11-20 of 89 results. Next

A066247 Characteristic function of composite numbers: 1 if n is composite else 0.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 09 2001

Keywords

Comments

a(n) = signum(A066246(n)), where signum = A057427. For n > 1: a(n) = 1 - A010051(n) = A005171(n).
a(n) = A057427(A086971(n)). - Reinhard Zumkeller, Dec 14 2012

Crossrefs

Cf. A065855 (partial sums).

Programs

Formula

For n>1 a(n) = 1-floor(1/A001222(n)). - Enrique Pérez Herrero, Aug 08 2012
a(n) = A065855(n)-A065855(n-1) = 1-A000720(n)+A000720(n-1). - Chayim Lowen, Jul 23 2015
Dirichlet g.f.: Sum_{n>=1} a(n)/n^s = Zeta(s)-1-P(s), where P is prime zeta. - Enrique Pérez Herrero, Aug 08 2012
a(n) = 1 if A001222(n) > 1, 0 otherwise. - Antti Karttunen, Nov 20 2017

A108954 a(n) = pi(2*n) - pi(n). Number of primes in the interval (n,2n].

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 2, 3, 4, 3, 4, 3, 3, 4, 5, 4, 4, 4, 4, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 9, 10, 9, 9, 10, 10, 9, 9, 10, 10, 11, 12, 11, 12, 13, 13, 14, 14, 13, 13, 12, 12, 12, 13, 13, 14, 13, 13, 14, 15, 14, 14, 13, 13, 14, 15, 15, 15, 15, 15, 15, 16, 15, 16
Offset: 1

Views

Author

Cino Hilliard, Jul 22 2005

Keywords

Comments

a(n) < log(4)*n/log(n) < 7*n/(5*log(n)) for n > 1. - Reinhard Zumkeller, Mar 04 2008
Bertrand's postulate is equivalent to the formula a(n) >= 1 for all positive integers n. - Jonathan Vos Post, Jul 30 2008
Number of distinct prime factors > n of binomial(2*n,n). - T. D. Noe, Aug 18 2011
f(2, 2n) - f(3, n) < a(n) < f(3, 2n) - f(2, n) for n > 5889 where f(k, x) = x/log x * (1 + 1/log x + k/(log x)^2). The constant 3 can be improved. - Charles R Greathouse IV, May 02 2012
For n >= 2, a(n) is the number of primes appearing in the 2nd row of an n X n square array whose elements are the numbers from 1..n^2, listed in increasing order by rows. - Wesley Ivan Hurt, May 17 2021

References

  • F. Irschebeck, Einladung zur Zahlentheorie, BI Wissenschaftsverlag 1992, p. 40.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 181-182.

Crossrefs

Cf. A067434 (number of prime factors in binomial(2*n,n)), A193990, A074990.
Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Maple
    A108954 := proc(n)
        numtheory[pi](2*n)-numtheory[pi](n) ;
    end proc: # R. J. Mathar, Nov 03 2017
  • Mathematica
    Table[Length[Select[Transpose[FactorInteger[Binomial[2 n, n]]][[1]], # > n &]], {n, 100}] (* T. D. Noe, Aug 18 2011 *)
    f[n_] := Length@ Select[ Range[n + 1, 2n], PrimeQ]; Array[f, 100] (* Robert G. Wilson v, Mar 20 2012 *)
    Table[PrimePi[2n]-PrimePi[n],{n,90}] (* Harvey P. Dale, Mar 11 2013 *)
  • PARI
    g(n) = for(x=1,n,y=primepi(2*x)-primepi(x);print1(y","))
    
  • Python
    from sympy import primepi
    def A108954(n): return primepi(n<<1)-primepi(n) # Chai Wah Wu, Aug 19 2024

Formula

a(n) = A000720(2*n)-A000720(n).
For n > 1, a(n) = A060715(n). - David Wasserman, Nov 04 2005
Conjecture: G.f.: Sum_{i>0} Sum_{j>=i|i+j is prime} x^j. - Benedict W. J. Irwin, Mar 31 2017
From Wesley Ivan Hurt, Sep 20 2021: (Start)
a(n) = Sum_{k=1..n} A010051(2*n-k+1).
a(n) = Sum_{k=n*(n+1)/2+2..(n+1)*(n+2)/2} A010051(A128076(k)). (End)

A373675 Sums of maximal runs of powers of primes A000961.

Original entry on oeis.org

15, 24, 11, 13, 33, 19, 23, 25, 27, 29, 63, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81, 83, 89, 97, 101, 103, 107, 109, 113, 121, 125, 255, 131, 137, 139, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239
Offset: 1

Views

Author

Gus Wiseman, Jun 16 2024

Keywords

Comments

A run of a sequence (in this case A000961) is an interval of positions at which consecutive terms differ by one.

Examples

			The maximal runs of powers of primes begin:
   1   2   3   4   5
   7   8   9
  11
  13
  16  17
  19
  23
  25
  27
  29
  31  32
  37
  41
  43
  47
  49
		

Crossrefs

A000040 lists the primes, differences A001223.
A000961 lists all powers of primes (A246655 if not including 1).
A025528 counts prime-powers up to n.
A057820 gives first differences of consecutive prime-powers, gaps A093555.
A361102 lists all non-prime-powers (A024619 if not including 1).
See link for composite, prime, nonsquarefree, and squarefree runs.
Prime-power runs: A373675, min A373673, max A373674, length A174965.
Non-prime-power runs: A373678, min A373676, max A373677, length A110969.
Prime-power antiruns: A373576, min A120430, max A006549, length A373671.
Non-prime-power antiruns: A373679, min A373575, max A255346, length A373672.

Programs

  • Mathematica
    pripow[n_]:=n==1||PrimePowerQ[n];
    Total/@Split[Select[Range[nn],pripow],#1+1==#2&]//Most

A073051 Least k such that Sum_{i=1..k} (prime(i) + prime(i+2) - 2*prime(i+1)) = 2n + 1.

Original entry on oeis.org

1, 3, 8, 23, 33, 45, 29, 281, 98, 153, 188, 262, 366, 428, 589, 737, 216, 1182, 3301, 2190, 1878, 1830, 7969, 3076, 3426, 2224, 3792, 8027, 4611, 4521, 3643, 8687, 14861, 12541, 15782, 3384, 34201, 19025, 17005, 44772, 23282, 38589, 14356
Offset: 1

Views

Author

Robert G. Wilson v, Aug 15 2002

Keywords

Comments

Also, least k such that 2n = A001223(k-1) = prime(k+1) - prime(k), where prime(k) = A001223(n). - Alexander Adamchuk, Jul 30 2006
Also the least number k>0 such that the k-th maximal run of composite numbers has length 2n-1. For example, the 8th such run (24,25,26,27,28) is the first of length 2(3)-1, so a(3) = 8. Also positions of first appearances in A176246 (A046933 without first term). - Gus Wiseman, Jun 12 2024

Examples

			a(3) = 8 because 1+0+2-2+2-2+2+2 = 5 and (5+1)/2 = 3.
		

Crossrefs

Position of first appearance of 2n+1 in A176246.
For nonsquarefree runs we have a bisection of A373199.
A000040 lists the primes, first differences A001223.
A002808 lists the composite numbers, differences A073783, sums A053767.
A046933 counts composite numbers between primes.
A065855 counts composite numbers up to n.

Programs

  • Mathematica
    NextPrim[n_Integer] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; a = Table[0, {50}]; s = 0; k = 1; p = 0; q = 2; r = 3; While[k < 10^6, p = q; q = r; r = NextPrim[q]; s = s + p + r - 2q; If[s < 101 && a[[(s + 1)/2]] == 0, a[[(s + 1)/2]] = k]; k++ ]; a
  • PARI
    a001223(n) = prime(n+1) - prime(n);
    a(n) = {my(k = 1); while(2*n != A001223(k+1), k++); k;} \\ Michel Marcus, Nov 20 2016

Formula

a(n) = A038664(n) - 1. - Filip Zaludek, Nov 19 2016

A373678 Sums of maximal runs of non-prime-powers.

Original entry on oeis.org

1, 6, 10, 12, 29, 18, 63, 24, 26, 28, 30, 138, 117, 42, 135, 48, 153, 280, 60, 125, 131, 207, 72, 380, 80, 82, 430, 651, 297, 102, 315, 108, 333, 819, 369, 126, 259, 670, 138, 1296, 150, 770, 800, 495, 168, 513, 880, 180, 1674, 192, 585, 198, 2255, 2387, 675
Offset: 1

Views

Author

Gus Wiseman, Jun 16 2024

Keywords

Comments

We consider 1 to be a power of a prime and a non-prime-power, but not a prime-power.
A run of a sequence (in this case A361102) is an interval of positions at which consecutive terms differ by one.

Examples

			The maximal runs of non-powers of primes begin:
   1
   6
  10
  12
  14  15
  18
  20  21  22
  24
  26
  28
  30
  33  34  35  36
  38  39  40
  42
  44  45  46
  48
  50  51  52
  54  55  56  57  58
  60
		

Crossrefs

A000040 lists the primes, differences A001223.
A000961 lists all powers of primes (A246655 if not including 1).
A025528 counts prime-powers up to n.
A057820 gives first differences of consecutive prime-powers, gaps A093555.
A361102 lists all non-prime-powers (A024619 if not including 1).
See link for composite, prime, nonsquarefree, and squarefree runs.
Prime-power runs: A373675, min A373673, max A373674, length A174965.
Non-prime-power runs: A373678, min A373676, max A373677, length A110969.
Prime-power antiruns: A373576, min A120430, max A006549, length A373671.
Non-prime-power antiruns: A373679, min A373575, max A255346, length A373672.

Programs

  • Mathematica
    Total/@Split[Select[Range[100],!PrimePowerQ[#]&],#1+1==#2&]//Most

A070046 Number of primes between prime(n) and 2*prime(n) exclusive.

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 9, 9, 9, 9, 11, 13, 12, 13, 14, 13, 15, 15, 16, 19, 20, 19, 19, 18, 18, 23, 23, 25, 25, 27, 26, 28, 28, 28, 28, 30, 30, 32, 32, 32, 32, 35, 38, 38, 38, 39, 39, 39, 41, 42, 43, 42, 42, 42, 42, 42, 44, 49, 50, 49, 49, 54, 54, 56, 55, 55, 55, 57, 58
Offset: 1

Views

Author

Enoch Haga, May 05 2002

Keywords

Examples

			a(1)=1 because between p=2 and 4 there is exactly one prime, 3.
a(10)=6 since six consecutive primes (31,37,41,43,47,53) are located between p(10) = 29 and 58.
		

Crossrefs

Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Maple
    N:= 1000: # to get a(n) for n <= pi(N)
    Primes:=select(isprime,[$1..N]):
    seq(numtheory:-pi(2*Primes[n])-n, n=1..nops(Primes)); # Robert Israel, Aug 28 2014
  • Mathematica
    pp[n_]:=Module[{pr=Prime[n]},PrimePi[2pr]-n]; Array[pp,80] (* Harvey P. Dale, Mar 30 2015; edited by Zak Seidov, Oct 18 2022  *)
  • PARI
    forprime(p=2, 5000, n=0; for(q=p+1, 2*p-1, if(isprime(q), n++)); print1(n, ", ")) \\ Harry J. Smith, Dec 13 2007, improved by Colin Barker, Aug 28 2014
    
  • PARI
    a(n)=primepi(2*prime(n))-n \\ Charles R Greathouse IV, Aug 28 2014
    
  • Python
    from sympy import prime, primepi
    def A070046(n): return primepi(prime(n)<<1)-n # Chai Wah Wu, Oct 22 2024

Formula

a(n) = primepi(2*prime(n))-n. - Charles R Greathouse IV, Aug 28 2014
a(n) = A060715(A000040(n)).
a(n) = A063124(n)-1. - N. J. A. Sloane, Oct 19 2024

Extensions

Edited by N. J. A. Sloane, May 15 2008 at the suggestion of R. J. Mathar

A121053 A sequence S describing the position of its prime terms.

Original entry on oeis.org

2, 3, 5, 1, 7, 8, 11, 13, 10, 17, 19, 14, 23, 29, 16, 31, 37, 20, 41, 43, 22, 47, 53, 25, 59, 27, 61, 30, 67, 71, 73, 33, 79, 35, 83, 38, 89, 97, 40, 101, 103, 44, 107, 109, 46, 113, 127, 49, 131, 51, 137, 54, 139, 149, 56, 151, 58, 157, 163, 62, 167, 173, 64, 179, 66, 181, 191, 69, 193, 72, 197, 199, 211, 75, 223, 77, 227, 80, 229
Offset: 1

Views

Author

Eric Angelini, Aug 10 2006

Keywords

Comments

S reads like this:
"At position 2, there is a prime in S" [indeed, this is 3]
"At position 3, there is a prime in S" [indeed, this is 5]
"At position 5, there is a prime in S" [indeed, this is 7]
"At position 1, there is a prime in S" [indeed, this is 2]
"At position 7, there is a prime in S" [indeed, this is 11]
"At position 8, there is a prime in S" [indeed, this is 13]
"At position 11, there is a prime in S" [indeed, this is 19]
"At position 13, there is a prime in S" [indeed, this is 23]
"At position 10, there is a prime in S" [indeed, this is 17], etc.
S is built with this rule: when you are about to write a term of S, always use the smallest integer not yet present in S and not leading to a contradiction.
Thus one cannot start with 1; this would read: "At position 1, there is a prime number in S" [no, 1 is not a prime]
So start S with 2 and the rest follows smoothly.
S contains all the primes and they appear in their natural order.
Does the ratio primes/composites in S tend to a limit?
The definition and the comments above are Eric Angelini's original submission. A more formal definition would be "Lexicographically earliest sequence of distinct positive numbers such that k is a term of the sequence iff a(k) is a prime". However, to honor Eric Angelini's memory, we will retain his enigmatic definition. - N. J. A. Sloane, Dec 20 2024
Comments from N. J. A. Sloane, Nov 14 2024 (Start)
Theorem. Let p(k) = k-th prime, c(k) = k-th composite number. For n >= 5, if n is a prime or n = c(2*t+1) for some t, then a(n) = p(k) where k = floor((n+PrimePi(n))/2); otherwise, n = c(2*t) for some t and a(n) = c(2*t+1).
The proof will be added later (see reference).
The theorem implies that the sequence consists of the primes and the odd-subscripted composite numbers.
All of Dean Hickerson's comments below follow from this theorem. (End)
Comments from Dean Hickerson, Aug 11 2006: (Start)
In the limit, exactly half of the terms are primes. Here's a formula, found empirically, for a(n) for n >= 5:
Let pi(n) be the number of primes <= n and p(n) be the n-th prime. Then for n >= 5:
- if n is prime or (n is composite and n+pi(n) is even) then a(n) = p(floor((n+pi(n))/2));
- if n is composite and n+pi(n) is odd and n+1 is composite then a(n) = n+1;
- if n is composite and n+pi(n) is odd and n+1 is prime then a(n) = n+2.
Also, for n >= 5, a(n) is in the sequence iff either n is prime or n+pi(n) is even.
(This could all be proved by induction on n.)
It follows from this that, for n >= 4, the number of primes among a(1), ..., a(n) is exactly floor((n+pi(n))/2). Since pi(n)/n -> 0 as n -> infinity, this is asymptotic to n/2. (End)

References

  • N. J. A. Sloane, The Remarkable Sequences of Éric Angelini, MS in preparation, December 2024.

Crossrefs

See A377901 for the analogous sequence if 1 is regarded as a prime.

Programs

  • Maple
    chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855, number of composites <= n
    A002808 := proc(n) option remember ; local a ; if n = 1 then 4; else for a from procname(n-1)+1 do if not isprime(a) then return a; end if; end do ; end if; end proc;
    A121053 := proc(n) local init,t1;
    init := [2,3,5,1,7];
    if n<=5 then return(init[n]); fi;
    if isprime(n) or (not isprime(n) and ((chi(n) mod 2) = 1))
       then ithprime(floor((n+numtheory:-pi(n))/2));
    else t1 := chi(n); A002808(t1+1);
    fi; end;
    [seq(A121053(n),n=1..120)]; # N. J. A. Sloane, Nov 14 2024
  • Mathematica
    a[1]=2; a[2]=3; a[3]=5; a[4]=1; a[n_ /; PrimeQ[n] || !PrimeQ[n] && EvenQ[n+PrimePi[n]]] := Prime[Floor[(n+PrimePi[n])/2]]; a[n_ /; !PrimeQ[n] && OddQ[n+PrimePi[n]]] := If[!PrimeQ[n+1], n+1, n+2]; Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 21 2011, based on Dean Hickerson's formulas *)
  • Python
    from sympy import isprime, prime, primepi, composite, compositepi
    def a(n): return [2, 3, 5, 1, 7][n-1] if n < 6 else prime(n+primepi(n)>>1) if isprime(n) or (c:=compositepi(n))&1 else composite(c+1)
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Nov 29 2024
    
  • Python
    # faster for initial segment of sequence
    from sympy import isprime, sieve
    from itertools import count, islice
    def nextcomposite(n): return next(k for k in count(n+1) if k not in sieve)
    def agen(): # generator of terms
        alst, chin, pin, nextc = [2, 3, 5, 1, 7], 1, 3, 6
        yield from alst
        for n in count(6):
            if isprimen:=n < nextc: pin += 1
            else: chin, nextc = chin + 1, nextcomposite(nextc)
            yield sieve[(n+pin)>>1] if isprimen or chin&1 else nextc
    print(list(islice(agen(), 80))) # Michael S. Branicky, Nov 29 2024

A063124 a(n) = # { primes p | prime(n) <= p < 2*prime(n) } where prime(n) is the n-th prime.

Original entry on oeis.org

2, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 10, 10, 10, 10, 12, 14, 13, 14, 15, 14, 16, 16, 17, 20, 21, 20, 20, 19, 19, 24, 24, 26, 26, 28, 27, 29, 29, 29, 29, 31, 31, 33, 33, 33, 33, 36, 39, 39, 39, 40, 40, 40, 42, 43, 44, 43, 43, 43, 43, 43, 45, 50, 51, 50, 50, 55, 55, 57, 56, 56, 56, 58
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 08 2001

Keywords

Comments

a(n) is the number of primes between prime(n) and 2*prime(n) inclusive. - Sean A. Irvine, Apr 18 2023
Also for x = Product_{i=n..n+k} A000040(i), the least k such that A003961(x) > 2*x. - Antti Karttunen, Dec 08 2024

Examples

			a(10) = 7 as there are 7 primes between prime(10) = 29 and 58 = 29*2: 29, 31, 37, 41, 43, 47, 53.
		

Crossrefs

Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Maple
    A062134 := proc(n) numtheory:-pi(2*ithprime(n))-n+1; end; # N. J. A. Sloane, Oct 19 2024
    [seq(A062134(n),n=1..100)];
  • Mathematica
    Table[PrimePi[2*Prime[n]] - n + 1, {n, 100}] (* Paolo Xausa, Oct 22 2024 *)
  • PARI
    a(n)={1 + primepi(2*prime(n)) - n} \\ Harry J. Smith, Aug 19 2009

Formula

a(n) = A035250(prime(n)).
a(n) = A070046(n) + 1. - Sean A. Irvine, Apr 18 2023
From Antti Karttunen, Dec 08 2024: (Start)
a(n) = n-A331677(n) = 1+n-A334051(n).
a(n) = 1+A000720(2*A000040(n))-n. [After Harry J. Smith's PARI-program]
a(n) < A108227(n). [Assuming M. F. Hasler's interpretation in May 08 2017 comment in the latter]
a(n) = A001222(A378746(n)).
(End)

Extensions

Definition clarified by N. J. A. Sloane, Oct 04 2024

A245703 Permutation of natural numbers: a(1) = 1, a(p_n) = A014580(a(n)), a(c_n) = A091242(a(n)), where p_n = n-th prime, c_n = n-th composite number and A014580(n) and A091242(n) are binary codes for n-th irreducible and n-th reducible polynomials over GF(2), respectively.

Original entry on oeis.org

1, 2, 3, 4, 7, 5, 11, 6, 8, 12, 25, 9, 13, 17, 10, 14, 47, 18, 19, 34, 15, 20, 31, 24, 16, 21, 62, 26, 55, 27, 137, 45, 22, 28, 42, 33, 37, 23, 29, 79, 59, 35, 87, 71, 36, 166, 41, 58, 30, 38, 54, 44, 61, 49, 32, 39, 99, 76, 319, 46, 91, 108, 89, 48, 200, 53, 97, 75, 40, 50, 203, 70, 67, 57, 78, 64, 43, 51
Offset: 1

Views

Author

Antti Karttunen, Aug 02 2014

Keywords

Comments

All the permutations A091202, A091204, A106442, A106444, A106446, A235041 share the same property that primes (A000040) are mapped bijectively to the binary representations of irreducible GF(2) polynomials (A014580) but while they determine the mapping of composites (A002808) to the corresponding binary codes of reducible polynomials (A091242) by a simple multiplicative rule, this permutation employs index-recursion also in that case.

Crossrefs

Programs

  • PARI
    allocatemem(123456789);
    a014580 = vector(2^18);
    a091242 = vector(2^22);
    isA014580(n)=polisirreducible(Pol(binary(n))*Mod(1, 2)); \\ This function from Charles R Greathouse IV
    i=0; j=0; n=2; while((n < 2^22), if(isA014580(n), i++; a014580[i] = n, j++; a091242[j] = n); n++)
    A245703(n) = if(1==n, 1, if(isprime(n), a014580[A245703(primepi(n))], a091242[A245703(n-primepi(n)-1)]));
    for(n=1, 10001, write("b245703.txt", n, " ", A245703(n)));
    
  • Scheme
    ;; With memoization-macro definec.
    (definec (A245703 n) (cond ((= 1 n) n) ((= 1 (A010051 n)) (A014580 (A245703 (A000720 n)))) (else (A091242 (A245703 (A065855 n))))))

Formula

a(1) = 1, a(p_n) = A014580(a(n)) and a(c_n) = A091242(a(n)), where p_n is the n-th prime, A000040(n) and c_n is the n-th composite, A002808(n).
a(1) = 1, after which, if A010051(n) is 1 [i.e. n is prime], then a(n) = A014580(a(A000720(n))), otherwise a(n) = A091242(a(A065855(n))).
As a composition of related permutations:
a(n) = A245702(A135141(n)).
a(n) = A091204(A245821(n)).
Other identities. For all n >= 1, the following holds:
a(A007097(n)) = A091230(n). [Maps iterates of primes to the iterates of A014580. Permutation A091204 has the same property]
A091225(a(n)) = A010051(n). [Maps primes to binary representations of irreducible GF(2) polynomials, A014580, and nonprimes to union of {1} and the binary representations of corresponding reducible polynomials, A091242. The permutations A091202, A091204, A106442, A106444, A106446 and A235041 have the same property.]

A075084 Number of composite numbers c with n <= c <= 2*n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 5, 7, 7, 7, 8, 9, 10, 12, 12, 12, 13, 15, 15, 17, 17, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 26, 27, 27, 28, 28, 28, 30, 31, 31, 32, 33, 34, 36, 36, 37, 38, 40, 40, 41, 41, 41, 42, 43, 43, 44, 44, 45, 46, 48, 49, 51, 52, 52, 53, 53, 54, 56, 56, 56, 57, 59, 60
Offset: 1

Views

Author

Amarnath Murthy, Sep 11 2002

Keywords

Comments

The number of composite numbers <= n is n less the number of primes less 1.
The sequence is nondecreasing.

Examples

			a(8) = 7: the composite numbers are 8,9,10,12,14,15 and 16.
		

Crossrefs

Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Maple
    chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855
    A075084 := proc(n) chi(2*n) - chi(n-1); end;
    a := [seq(A075084(n),n=1..120)]; # N. J. A. Sloane, Oct 20 2024
  • Mathematica
    Table[n - PrimePi[2n] + PrimePi[n - 1] + 1, {n, 2, 75}]
  • PARI
    a(n) = if (n>1, n - primepi(2*n) + primepi(n-1) + 1, 0); \\ Michel Marcus, Oct 21 2024
  • Python
    from sympy import primepi
    def A075084(n): return n+primepi(n-1)-primepi(n<<1)+1 if n>1 else 0 # Chai Wah Wu, Oct 20 2024
    

Formula

a(n) = n - pi(2n) + pi(n-1) + 1, for n>1.

Extensions

Edited by Robert G. Wilson v, Sep 12 2002
Definition clarified by N. J. A. Sloane, Oct 20 2024
Previous Showing 11-20 of 89 results. Next