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 31-40 of 53 results. Next

A257727 Permutation of natural numbers: a(1) = 1, a(oddprime(n)) = 1 + 2*a(n), a(not_an_oddprime(n)) = 2*a(n-1).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 9, 14, 11, 16, 20, 24, 13, 18, 15, 28, 22, 32, 17, 40, 48, 26, 36, 30, 21, 56, 25, 44, 64, 34, 80, 96, 19, 52, 72, 60, 29, 42, 23, 112, 50, 88, 33, 128, 68, 160, 192, 38, 41, 104, 144, 120, 58, 84, 49, 46, 27, 224, 100, 176, 66, 256, 37, 136, 320, 384, 31, 76, 57, 82, 208, 288, 240, 116, 45
Offset: 1

Views

Author

Antti Karttunen, May 09 2015

Keywords

Comments

Here oddprime(n) = n-th odd prime = A065091(n) = A000040(n+1), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).

Examples

			For n=2, which is the second natural number >= 1 that is not an odd prime [2 = A065090(2)], we compute 2*a(1) = 2 = a(2).
For n=4, which is A065090(3), we compute 2*a(3-1) = 2*2 = 4.
For n=5, and 5 is the second odd prime [5 = A065091(2)], thus a(5) = 1 + 2*a(2) = 5.
For n=9, which is the sixth natural number >= 1 not an odd prime (9 = A065090(6)), we compute 2*a(6-1) = 2*5 = 10.
For n=11, which is the fourth odd prime [11 = A065091(4)], we compute 1 + 2*a(4) = 1 + 2*4 = 9, thus a(11) = 9.
		

Crossrefs

Inverse: A257728.
Related or similar permutations: A246377, A246378, A257725, A257730, A257801.

Formula

a(1) = 1; a(2) = 2; and for n > 2, if A010051(n) = 1 [i.e., when n is a prime], then a(n) = 1 + 2*a(A000720(n)-1), otherwise a(n) = 2*a(A062298(n)).
As a composition of other permutations:
a(n) = A246377(A257730(n)).
a(n) = A257725(A257801(n)).

A337978 a(n) = n + pi(n) - pi(n + pi(n)), where pi(n) is the prime count of n (n>=1).

Original entry on oeis.org

1, 1, 2, 3, 4, 5, 6, 7, 7, 8, 10, 10, 11, 12, 13, 14, 15, 16, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 27, 28, 29, 29, 30, 31, 32, 32, 34, 35, 36, 37, 38, 39, 41, 42, 42, 43, 44, 45, 46, 47, 48, 48, 50, 51, 51, 52, 52, 53, 55, 56, 57, 58, 59, 60, 60, 61, 63
Offset: 1

Views

Author

Ya-Ping Lu, Oct 06 2020

Keywords

Comments

It seems that this is a nondecreasing sequence and a(n) < n for n >= 2.
Proofs of the above observations are provided in the Links below.

Crossrefs

Programs

  • Maple
    f:= n -> n + numtheory:-pi(n) - numtheory:-pi(n + numtheory:-pi(n)):
    map(f, [$1..100]); # Robert Israel, Feb 12 2024
  • Mathematica
    pc[n_]:=With[{c=PrimePi[n]},n+c-PrimePi[n+c]]; Array[pc,70] (* Harvey P. Dale, Jan 18 2024 *)
  • PARI
    a(n) = {my(x = n + primepi(n)); x - primepi(x); } \\ Michel Marcus, Oct 06 2020
  • Python
    from sympy import primepi
    print(1)
    n = 2
    for n in range(2, 10001):
        n_f = n + primepi(n)
        a = n_f - primepi(n_f)
        print(a)
    

Formula

a(n) = n + pi(n) - pi(n + pi(n)).

A065857 The (10^n)-th composite number.

Original entry on oeis.org

4, 18, 133, 1197, 11374, 110487, 1084605, 10708555, 106091745, 1053422339, 10475688327, 104287176419, 1039019056246, 10358018863853, 103307491450820, 1030734020030318, 10287026204717358, 102692313540015924, 1025351434864118026, 10239531292310798956, 102270102190290407386
Offset: 0

Views

Author

Labos Elemer, Nov 26 2001

Keywords

Examples

			The 100th composite number is C(100)=133, while the 100th prime is 541. In general: A000720(m) < A062298(m) < m < A002808(m) < A000040(m), for example pi(100)=25 < 75 < 100 < C(100)=133 < prime(100)=541.
		

References

  • A. E. Bojarincev, Asymptotic expressions for the n-th composite number. Univ. Mat. Zap. 6:21-43(1967). [in Russian]
  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 133, p. 45, Ellipses, Paris 2008.

Crossrefs

Programs

  • Mathematica
    Composite[n_Integer] := Block[ {k = n + PrimePi[n] + 1 }, While[ k != n + PrimePi[k] + 1, k = n + PrimePi[k] + 1]; Return[k]];
    Table[Composite[10^n], {n, 0, 9}]
  • PARI
    a(n)=my(k=10^n);forcomposite(n=4,2*k+2,if(k--==0,return(n))) \\ Charles R Greathouse IV, May 30 2013

Formula

a(n) = A002808(A011557(n)).
a(n) = 10^(n + n/log n + 2n/log^2 + 4n/log^3 n + O(n/log^4 n)). See Bojarincev for an asymptotic expansion. - Charles R Greathouse IV, May 30 2013

Extensions

More terms from Robert G. Wilson v, Nov 26 2001
a(14) from Lekraj Beedassy, Jul 14 2008
a(15)-a(19) from Chai Wah Wu, Apr 16 2018
a(20) from Chai Wah Wu, Aug 23 2018

A065863 Remainder when n-th prime is divided by the number of nonprimes not exceeding n.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 2, 3, 3, 5, 1, 2, 6, 3, 2, 3, 9, 6, 1, 11, 8, 9, 13, 14, 1, 16, 13, 12, 14, 13, 7, 5, 5, 1, 5, 1, 7, 7, 5, 5, 11, 7, 17, 13, 11, 7, 19, 25, 23, 19, 17, 17, 19, 23, 23, 23, 23, 19, 25, 23, 25, 29, 37, 35, 31, 29, 43, 43, 47, 43, 47, 47, 3, 2, 1, 53, 53, 55, 2, 3, 6, 1, 11, 6
Offset: 1

Views

Author

Labos Elemer, Nov 26 2001

Keywords

Examples

			For n=25, prime(25)=97, n - pi(n) = 25 - 9 = 16, a(25)=1 because 97 = 6*16 + 1.
		

Crossrefs

Programs

  • Mathematica
    Table[Mod[Prime[n],n-PrimePi[n]],{n,90}] (* Harvey P. Dale, Aug 04 2015 *)
  • PARI
    a(n) = { prime(n)%(n - primepi(n)) } \\ Harry J. Smith, Nov 02 2009

Formula

a(n) = prime(n) mod (n - pi(n)) = A000040(n) mod A062298(n).

A337979 Define a map f(n):= n-> n + pi(n) - pi(n + pi(n)), where pi(n) is the prime count of n (n>=1). a(n) is the number of steps for n to reach 1 under repeated iteration of f.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Oct 05 2020

Keywords

Comments

For any integer n > 1, pi(n + pi(n)) > pi(n) according to Lu and Deng (see Links). Thus, n + pi(n) - pi(n + pi(n)) < n, which means n is reduced by at least 1 every time map f is applied, eventually reaching 1 under repeated iteration of f.
It seems that the sequence contains all nonnegative integers.

Examples

			a(1) = 0 because f^0(1) = 1;
a(2) = 1 because f(2) = 2 + pi(2) - pi(2 + pi(2)) = 1;
a(4) = 3 because f^3(4) = f^2(f(4)) = f^2(3) = f(f(3)) = f(2) = 1.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 0, 1+a((
          pi-> n+pi(n)-pi(n+pi(n)))(numtheory[pi])))
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Oct 24 2020
  • Mathematica
    f[n_] := Module[{x = n + PrimePi[n]}, x - PrimePi[x]];
    a[n_] := Module[{nb = 0, m = n}, While[m != 1, m = f[m]; nb++]; nb];
    Array[a, 100] (* Jean-François Alcover, Oct 24 2020, after PARI code *)
  • PARI
    f(n) = {my(x = n + primepi(n)); x - primepi(x);} \\ A337978
    a(n) = {my(nb=0); while (n != 1, n = f(n); nb++); nb;} \\ Michel Marcus, Oct 06 2020
  • Python
    from sympy import primepi
    print(0)
    n = 2
    for n in range (2, 10000001):
        ct = 0
        n_l = n
        pi_l = primepi(n)
        while ct >= 0:
            n_r = n_l + pi_l
            pi_r = primepi(n_r)
            n_l = n_r - pi_r
            pi_l = primepi(n_l)
            ct += 1
            if n_l == 1:
                print(ct)
                break
    

Formula

f^a(n) (n) = 1, where f = A062298(A095117) and m-fold iteration of f is denoted by f^m.

A092852 Number of composites <= A092802(n).

Original entry on oeis.org

2, 36, 412, 4371, 45118, 460161, 4663480, 47087659, 474329018, 4770493824, 47924729801, 481060418376, 4825817782189, 48387664042144, 484992123875142, 4859631205206357, 48681601698828085, 487571138851821274, 4882443976989269954, 48884842829781286250, 489393391263430721900
Offset: 1

Views

Author

Enoch Haga, Mar 07 2004

Keywords

Examples

			Up to 10^1 there are 4 composites: 4 + 6 + 8 + 9 = 27. The rounded mean is A092802(1) = floor(27/4) = 7. There are 2 composites below 7: 4 and 6, so a(1) = 2.
		

Crossrefs

Formula

a(n) = A065855(A092802(n)) = A062298(A092802(n)) - 1 = A092802(n) - A000720(A092802(n)) - 1.

Extensions

a(9)-a(15) from Max Alekseyev, Aug 14 2013
a(16)-a(21) calculated using Kim Walisch's primecount and added by Amiram Eldar, Sep 05 2024

A157423 Triangle read by rows, T(n,k) = 0 if (n-k+1) is prime, else 1.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson & Mats Granvik, Feb 28 2009

Keywords

Comments

Row sums = A062298: (1, 1, 1, 2, 2, 3, 3, 4, 5, 6,...). Eigensequence of the triangle = A052284: (1, 1, 1, 2, 3, 5, 7, 11, 17, 27,...).

Examples

			First few rows of the triangle =
1;
0, 1;
0, 0, 1;
1, 0, 0, 1;
0, 1, 0, 0, 1;
1, 0, 1, 0, 0, 1;
0, 1, 0, 1, 0, 0, 1;
1, 0, 1, 0, 1, 0, 0, 1;
1, 1, 0, 1, 0, 1, 0, 0, 1;
1, 1, 1, 0, 1, 0, 1, 0, 0, 1;
0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1;
1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1;
0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1;
1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1;
...
Example: T(6,4) = 0 since (6 - 4 + 1) = 3, prime.
		

Crossrefs

Programs

  • Mathematica
    Table[If[PrimeQ[n-k+1],0,1],{n,15},{k,n}]//Flatten (* Harvey P. Dale, Jul 19 2016 *)

Formula

Triangle read by rows, T(n,k) = 0 if (n-k+1) is prime, else 1. By columns, A005171 in every column: where A005171(k) = 0 if k is prime.

A275306 Decimal expansion of 1/2 - Sum_{k>=1} 1/2^prime(k).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Jul 22 2016

Keywords

Comments

Composite constant: decimal value of A066247 interpreted as a binary number.
The characteristic function of composite numbers (A066247) has values 0, 0, 0, 1, 0, 1, 0, 1, 1, ... for n = 1, 2, 3, ... The constant obtained by concatenating these digits and interpreting them as a binary fraction is therefore C = 0.0001010111010... (base 2) = 0.0853174901...(base 10).
Continued fraction [0; 11, 1, 2, 1, 1, 2, 1, 1, 131, 2, 1, 1, 2, 6, 4, 2, 21, ...].

Examples

			0.0853174901... = (0.00010101110...)_2.
                        | | |||
                        4 6 8910
		

Crossrefs

Programs

  • Mathematica
    nn = 121; Take[#, nn] &@ PadLeft[First@ #, Abs@ Last@ # + Length@ First@ #] &@ RealDigits@ N[1/2 - Sum[ 1/2^Prime[k], {k, 10^4}], nn + 2] (* Michael De Vlieger, Jul 22 2016 *)
  • PARI
    s=.5; forprime(p=2,bitprecision(s)+2, s-=1.>>p); s \\ Charles R Greathouse IV, Jul 22 2016

Formula

Equals Sum_{k>=1} 1/2^A002808(k).
From Amiram Eldar, Aug 11 2020: (Start)
Equals Sum_{k>=1} 1/A073718(k).
Equals Sum_{k>=1} A066247(k)/2^k.
Equals -(1/2) + Sum_{k>=1} A062298(k)/2^(k+1). (End)
Equals Sum_{k >= 1} ((-1)^A010051(k))/2^(k+1). - Antonio Graciá Llorente, Jan 13 2024

A377899 a(n) = number of composite numbers c_{2*k+1} <= n, where c_m = A002808(m) is the m-th composite number.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 37, 37, 37
Offset: 1

Views

Author

N. J. A. Sloane, Nov 14 2024

Keywords

Examples

			c_1 = 4 and c_3 = 8 are <= 9, so a(9) = 2.
		

Crossrefs

Programs

  • Python
    from sympy import primepi
    def A377899(n): return n-primepi(n)>>1 # Chai Wah Wu, Nov 14 2024

Formula

a(n) = floor((n-A000720(n))/2). - Chai Wah Wu, Nov 14 2024

A063084 a(n) = pi(n-1)*n - pi(n)*(n-1), where pi() = A000720().

Original entry on oeis.org

0, -1, -1, 2, -2, 3, -3, 4, 4, 4, -6, 5, -7, 6, 6, 6, -10, 7, -11, 8, 8, 8, -14, 9, 9, 9, 9, 9, -19, 10, -20, 11, 11, 11, 11, 11, -25, 12, 12, 12, -28, 13, -29, 14, 14, 14, -32, 15, 15, 15, 15, 15, -37, 16, 16, 16, 16, 16, -42, 17, -43, 18, 18, 18, 18, 18, -48, 19, 19, 19, -51, 20, -52, 21, 21, 21, 21, 21, -57, 22, 22, 22, -60, 23, 23
Offset: 1

Views

Author

Labos Elemer, Aug 06 2001

Keywords

Comments

To define as positive sequence let C(n)= A062298; f(a) = pi(a) if a is nonprime, f(a)= C(a) if a is prime. - Daniel Tisdale, Nov 07 2008

Examples

			The function is positive for composite and negative for prime numbers. It is zero at n=1.
		

References

  • G. A. Kudrevatow, (1970): Exercises in Number Theory. Problem 488; page 56; Prosveshenie, Moscow [in Russian].

Crossrefs

Programs

  • PARI
    a(n)={if(n>1, primepi(n-1)*n - primepi(n)*(n-1), 0)} \\ Harry J. Smith, Aug 17 2009
Previous Showing 31-40 of 53 results. Next