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 41-50 of 53 results. Next

A065862 Remainder when n-th composite number is divided by the number of nonprimes not exceeding n.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 3, 1, 0, 2, 0, 1, 0, 7, 6, 7, 6, 8, 8, 7, 6, 7, 6, 6, 5, 4, 4, 6, 5, 6, 6, 5, 4, 3, 2, 4, 3, 2, 1, 2, 2, 4, 3, 2, 1, 2, 2, 1, 0, 0, 0, 1, 0, 38, 38, 39, 39, 40, 41, 42, 42, 42, 42, 43, 43, 44, 44, 44, 44, 45, 46, 47, 47, 48, 49, 49, 49, 51, 52, 52, 52, 54, 54, 54, 54, 54
Offset: 1

Views

Author

Labos Elemer, Nov 26 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Module[{nn=150,cmps,len},cmps=Select[Range[nn],CompositeQ];len=Length[ cmps];Mod[#[[1]],#[[2]]-PrimePi[#[[2]]]]&/@Thread[{cmps,Range[len]}]] (* Harvey P. Dale, Feb 21 2020 *)
  • PARI
    Composite(n) = { local(k); k=n + primepi(n) + 1; while (k != n + primepi(k) + 1, k = n + primepi(k) + 1); return(k) } { for (n = 1, 1000, a=Composite(n)%(n - primepi(n)); write("b065862.txt", n, " ", a) ) } \\ Harry J. Smith, Nov 02 2009

Formula

a(n) = c(n) mod (n - pi(n)) = A002808(n) mod (n - A000720(n)) = A002808(n) mod A062298(n).

A168048 a(n) = C(n)*Pi(n) where C(n) = number of nonprimes <= n, Pi(n) = number of primes <= n.

Original entry on oeis.org

0, 1, 2, 4, 6, 9, 12, 16, 20, 24, 30, 35, 42, 48, 54, 60, 70, 77, 88, 96, 104, 112, 126, 135, 144, 153, 162, 171, 190, 200, 220, 231, 242, 253, 264, 275, 300, 312, 324, 336, 364, 377, 406, 420, 434, 448, 480, 495, 510, 525, 540, 555, 592, 608, 624, 640, 656, 672
Offset: 1

Views

Author

Daniel Tisdale, Nov 17 2009

Keywords

Crossrefs

Programs

Formula

a(n) = A062298(n)*A000720(n).

Extensions

a(1) and terms after a(16) from R. J. Mathar, Nov 18 2009
Edited by Jon E. Schoenfield, May 10 2019

A279436 Number of nonprimes less than or equal to n that do not divide n.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 1, 3, 4, 5, 3, 6, 6, 7, 6, 9, 7, 10, 8, 11, 12, 13, 9, 14, 15, 15, 15, 18, 15, 19, 16, 20, 21, 22, 18, 24, 24, 25, 22, 27, 24, 28, 26, 27, 30, 31, 25, 32, 31, 34, 33, 36, 32, 37, 34, 39, 40, 41, 34, 42, 42, 41, 40, 45, 43, 47, 45, 48, 46, 50, 42, 51, 51, 50, 51, 54, 52, 56, 50, 55, 58, 59, 52, 60, 61, 62, 59, 64, 57, 65, 64, 67, 68, 69, 62, 71, 69, 70, 68
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 12 2016

Keywords

Examples

			a(10) = 4 because 10 has 4 divisors {1,2,5,10} therefore 6 non-divisors {3,4,6,7,8,9} out of which 4 are nonprimes {4,6,8,9}.
		

Crossrefs

Programs

  • Mathematica
    Table[n - PrimePi[n] - DivisorSigma[0, n] + PrimeNu[n], {n, 1, 100}]
  • PARI
    for(n=1,50, print1(n - primepi(n) - numdiv(n) + omega(n), ", ")) \\ G. C. Greubel, May 22 2017
    
  • PARI
    first(n)=my(v=vector(n),pp); forfactored(k=1,n, if(k[2][,2]==[1]~, pp++); v[k[1]]=k[1] - pp - numdiv(k) + omega(k)); v \\ Charles R Greathouse IV, May 23 2017
    
  • Python
    from sympy import primepi, divisor_count, primefactors
    def a(n): return 0 if n==1 else n - primepi(n) - divisor_count(n) + len(primefactors(n)) # Indranil Ghosh, May 23 2017

Formula

G.f.: A(x) = B(x) + C(x) - D(x), where B(x) = Sum_{k>=1} x^(2*k+1)/((1 - x^k)*(1 - x^(k+1))), C(x) = Sum_{k>=1} x^prime(k)/(1 - x^prime(k)), D(x) = Sum_{k>=1} x^prime(k)/(1 - x).
a(n) = n - A000720(n) - A000005(n) + A001221(n).
a(n) = A062298(n) - A033273(n).
a(n) = A049820(n) - A048865(n).
a(n) = A229109(n) - A082514(n).
a(A000040(n)) = A065890(n).
a(A000040(n)) + 1 = A014689(n).
A000040(n) - a(A000040(n)) = n + 1.

A334614 a(n) = pi(prime(n) - n) + n, where pi is the prime counting function.

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 11, 13, 15, 18, 19, 21, 22, 24, 26, 28, 30, 32, 34, 35, 36, 38, 40, 42, 45, 47, 48, 50, 51, 53, 55, 57, 60, 61, 65, 66, 67, 68, 70, 72, 74, 76, 77, 79, 81, 82, 85, 88, 89, 91, 93, 94, 95, 99, 101, 102, 104, 105, 106, 107, 108, 112, 116, 117
Offset: 1

Views

Author

Ya-Ping Lu, Sep 08 2020

Keywords

Comments

It can be shown that a(n) > a(n-1) >= 1 and a(n) <= 2*n - 1 < 2*n (see proofs in the Links section).

Crossrefs

Programs

  • Mathematica
    Table[PrimePi[Prime[n] - n] + n, {n, 1, 64}] (* Amiram Eldar, Sep 09 2020 *)
  • PARI
    a(n) = n + primepi(prime(n) - n); \\ Michel Marcus, Sep 09 2020
  • Python
    from sympy import prime, primepi
    for n in range(1, 100001):
        a_n = primepi(prime(n) - n) + n
        print(a_n)
    

Formula

a(n) = A000720(A014689(n)) + n.
a(n) = A065328(n) + n. - Michel Marcus, Sep 12 2020

A338260 a(n) is the number of nodes with depth of n in a binary tree defined as: root = 1 and a child (C) of a node (N) is such that A337978(C) = N. For nodes with two children, the smaller child is assigned as the left child and the bigger one as the right child. A child of a one-child node is assigned as the left child.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Oct 19 2020

Keywords

Comments

The binary tree, read from left to right in the order of increasing depth n, is the positive integer sequence A000027. The first 66 numbers are shown in the figure below.
1
2
3
4
5
6
7
8 \_(9)
10
11 \_12
13 14
15 16
(17) 18
19
20 \_21
22 23
24 25
(26) 27 \______28
29 30
31 \_32 (33)
34 35 \______36
37 38 39
(40) 41 42
43 44 \_45
46 47 48
(49) 50 51 \______52
53 (54)\_55 56 \______57
58 59 60 61
(62) 63 64 \_65 (66)
All right children are composite numbers and all prime numbers are left children.
a(n) in this sequence is the number of terms with value of n in A337979.

Crossrefs

Programs

  • Python
    from sympy import primepi
    def depth(k):
        d = 0
        while k > 1:
            k += primepi(k)
            k -= primepi(k)
            d += 1
        return d
    m = 1
    for n in range (0, 101):
        a = 0
        while depth(m + a) == n:
            a += 1
        print(a)
        m += a

A338521 The number of primes between n-primepi(n) and n.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Nov 01 2020

Keywords

Comments

There is at least one prime number between n-primepi(n) and n, or a(n) >= 1, for n >= 3 (see Corollary 3 in the paper by Ya_Ping Lu attached in the links).

Crossrefs

Programs

  • Mathematica
    Array[Subtract @@ Map[PrimePi, {#1 - 1, #1 - #2}] & @@ {#, PrimePi[#]} &, 105] (* Michael De Vlieger, Nov 05 2020 *)
  • PARI
    a(n) = primepi(n - 1) - primepi(n - primepi(n)); \\ Michel Marcus, Nov 01 2020
  • Python
    from sympy import primepi
    for n in range(1, 101):
        pi = primepi(n)
        pi_1 = primepi(n - 1)
        a = pi_1 - primepi(n - pi)
        print(a)
    

Formula

a(n) = primepi(n - 1) - primepi(n - primepi(n)).
a(n) = A000720(n - 1) - A000720(n - A000720(n)).
a(n) = A000720(n -1) - A000720(A062298(n)).

A349214 a(n) = Sum_{k=1..n} k^c(k), where c is the prime characteristic (A010051).

Original entry on oeis.org

1, 3, 6, 7, 12, 13, 20, 21, 22, 23, 34, 35, 48, 49, 50, 51, 68, 69, 88, 89, 90, 91, 114, 115, 116, 117, 118, 119, 148, 149, 180, 181, 182, 183, 184, 185, 222, 223, 224, 225, 266, 267, 310, 311, 312, 313, 360, 361, 362, 363, 364, 365, 418, 419, 420, 421, 422, 423, 482, 483, 544
Offset: 1

Views

Author

Wesley Ivan Hurt, Nov 10 2021

Keywords

Comments

For k in 1 <= k <= n, add k if k is prime, otherwise add 1. For example a(6) = 1 + 2 + 3 + 1 + 5 + 1 = 13.

Crossrefs

Partial sums of A089026.

Programs

  • Mathematica
    a[n_] := Sum[k^Boole[PrimeQ[k]], {k, 1, n}]; Array[a, 60] (* Amiram Eldar, Nov 11 2021 *)
  • PARI
    a(n) = sum(k=1, n, if (isprime(k), k, 1)); \\ Michel Marcus, Nov 11 2021
    
  • Python
    from sympy import primerange
    def A349214(n):
        p = list(primerange(2,n+1))
        return n-len(p)+sum(p) # Chai Wah Wu, Nov 11 2021

Formula

a(n) = A034387(n) + A062298(n). - Wesley Ivan Hurt, Nov 23 2021

A073725 a(n)-th composite number = phi(n-th composite number); a(1)=a(2)=0.

Original entry on oeis.org

0, 0, 1, 2, 1, 1, 2, 3, 3, 2, 3, 6, 5, 3, 11, 6, 10, 6, 3, 9, 11, 9, 14, 6, 10, 14, 9, 6, 11, 14, 13, 9, 28, 11, 20, 14, 10, 27, 14, 24, 18, 9, 19, 24, 20, 32, 11, 20, 29, 14, 14, 24, 27, 24, 42, 14, 20, 37, 27, 14, 45, 28, 39, 27, 14, 51, 29, 42, 31, 51, 20, 28, 42, 27, 20, 32, 32
Offset: 1

Views

Author

Labos Elemer, Aug 05 2002

Keywords

Examples

			Phi of 25th composite number = 10th composite number: n=25: A002808(25)=38, phi(38) = 18 = A002808(10) so a(25)=10.
		

Crossrefs

Programs

  • Mathematica
    c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x]; G[x_] := x-PrimePi[x]-1; a(n)=G[EulerPhi[c[n]]]

Formula

See program.

A102613 Numerator of the reduced fractions of the ratios of the number of primes less than n over the number of composites less than n.

Original entry on oeis.org

0, 1, 2, 1, 3, 1, 4, 1, 4, 2, 5, 5, 6, 3, 2, 3, 7, 7, 8, 2, 8, 4, 9, 3, 9, 9, 1, 9, 10, 1, 11, 11, 1, 11, 11, 11, 12, 6, 4, 3, 13, 13, 14, 7, 14, 7, 15, 5, 15, 3, 5, 15, 16, 8, 16, 2, 16, 8, 17, 17, 18, 9, 2, 9, 18, 3, 19, 19, 19, 19, 20, 5, 21, 21, 7, 21, 3, 7, 22, 11, 22, 11, 23, 23, 23, 23
Offset: 1

Views

Author

Cino Hilliard, Jan 30 2005

Keywords

Comments

Conjecture: The ratio pi(x)/(n-pi(x)) tends to 0 as n tends to infinity. This is evident from the fact that Li(x)/(n-Li(x)) -> 0 as n -> infinity but unfortunately not proof.

Crossrefs

Programs

  • PARI
    pixovcmpx(n) = for(x=1,n,print1(numerator(pi(x)/(x-pi(x)))",")) pi(n) = \Number of primes less than or equal to n. { local(c,x); c=0;forprime(x=1,n,c++);return(c) }
    
  • PARI
    a(n)=numerator(primepi(n)/(n-primepi(n))) \\ Jason Yuen, Aug 31 2024

Formula

a(n) = numerator(pi(n)/(n-pi(n))) = numerator(A000720(n)/A062298(n)). - Jason Yuen, Aug 31 2024

A131872 Set m = 0, n = 1. Find smallest k >= 2 such that pi(k) = (k-pi(k)) - (m-pi(m)); set a(n) = pi(k), m = k, n = n+1. Repeat.

Original entry on oeis.org

1, 4, 8, 11, 16, 23, 30, 39, 50, 62, 78, 97, 119, 141, 172, 205, 242, 284, 334, 393, 455, 531, 615, 704, 811, 928, 1059, 1213, 1373, 1560, 1761, 1988, 2239, 2524, 2833, 3180, 3557, 3983, 4448, 4942, 5503, 6126, 6791, 7522, 8331, 9228, 10188, 11228
Offset: 1

Views

Author

Manuel Valdivia, Oct 05 2007

Keywords

Comments

For n>1, a(n)-a(n-1) is approximately pi(n)^2/n.

Examples

			m=0, n=1; pi(2) = (2-1)-(0) = 1 = number of nonprimes from 1 to 2, a(1) = 1 is a term. Now n=2, m=2.
pi(9) = (9-4)-(2-1) = 4 = number of nonprimes from 3 to 9, a(2) = 4 is a term. Now n=3, m=9.
pi(21) = (21-8)-(9-4) = 8 = number of nonprimes from 10 to 21, a(3) = 8 is a term.
		

Crossrefs

Programs

  • Mathematica
    m=0; Do[If[PrimePi[n]==(n-PrimePi[n])-(m-PrimePi[m]), Print[PrimePi[n]]; m=n], {n, 1, 10^6, 1}]
  • PARI
    lista(nn) = my(m=0, list = List()); for (n=1, nn, my(k=2); while(primepi(k) != (k-primepi(k)) - (m-primepi(m)), k++); listput(list, primepi(k)); m = k;); Vec(list); \\ Michel Marcus, Nov 13 2023

Extensions

Edited by N. J. A. Sloane, Nov 05 2007
Previous Showing 41-50 of 53 results. Next