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

A338363 a(n) = n + pi(n) - pi(floor(n/2)), where pi = A000720.

Original entry on oeis.org

1, 3, 5, 5, 7, 7, 9, 10, 11, 11, 13, 14, 16, 16, 17, 18, 20, 21, 23, 24, 25, 25, 27, 28, 29, 29, 30, 31, 33, 34, 36, 37, 38, 38, 39, 40, 42, 42, 43, 44, 46, 47, 49, 50, 51, 51, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 64, 66, 67, 69, 69, 70, 71, 72, 73, 75, 76, 77, 78, 80, 81
Offset: 1

Views

Author

N. J. A. Sloane, Nov 04 2020

Keywords

Crossrefs

Programs

Formula

a(n) = n + A056171(n). - Alois P. Heinz, Nov 04 2020

A340716 Lexicographically earliest sequence of positive integers with as many distinct values as possible such that for any n > 0, a(n + pi(n)) = a(n) (where pi(n) = A000720(n) corresponds to the number of prime numbers <= n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 17 2021

Keywords

Comments

The condition "with as many distinct values as possible" means here that for any distinct m and n, provided the orbits of m and n under the map x -> x + pi(x) do not merge, then a(m) <> a(n).
This sequence has similarities with A003602 (A003602(2*n) = A003602(n)) and with A163491 (A163491(n+ceiling(n/2)) = A163491(n)).

Examples

			The first terms, alongside n + pi(n), are:
  n   a(n)  n + pi(n)
  --  ----  ---------
   1     1          1
   2     2          3
   3     2          5
   4     3          6
   5     2          8
   6     3          9
   7     4         11
   8     2         12
   9     3         13
  10     5         14
  11     4         16
  12     2         17
		

Crossrefs

See A003602, A163491 and A340717 for similar sequences.

Programs

  • PARI
    u=0; for (n=1, #a=vector(80), if (a[n]==0, a[n]=u++); print1 (a[n]", "); m=n+primepi(n); if (m<=#a, a[m]=a[n]))

Formula

a(n) = 2 iff n belongs to A061535.
a(A095116(n)) = n + 1.

A362527 a(1) = 2 and a(n+1) is the largest prime <= a(n) + n.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 19, 23, 31, 37, 47, 53, 61, 73, 83, 97, 113, 127, 139, 157, 173, 193, 211, 233, 257, 281, 307, 331, 359, 383, 409, 439, 467, 499, 523, 557, 593, 619, 653, 691, 727, 761, 797, 839, 883, 919, 953, 997, 1039, 1087, 1129, 1171, 1223, 1259, 1307
Offset: 1

Views

Author

Ya-Ping Lu, Apr 23 2023

Keywords

Comments

Conjecture: a(n+1) > a(n).
The conjecture holds for the first 2^32.5 =~ 6074001000 terms as all prime gaps up to 2^64 are known. - Charles R Greathouse IV, Apr 27 2023

Examples

			a(2) is the largest prime <= a(1) + 1 = 3. a(2) = 3.
a(3) is the largest prime <= a(2) + 2 = 5. a(3) = 5.
a(4) is the largest prime <= a(3) + 3 = 8. a(4) = 7.
		

Crossrefs

Programs

  • Mathematica
    A362527list[nmax_]:=Module[{n=2},NestList[NextPrime[#+n++,-1]&,2,nmax-1]];A362527list[100] (* Paolo Xausa, Aug 29 2023 *)
  • PARI
    first(n)=my(v=vector(n)); v[1]=2; for(k=1,n-1, v[k+1]=precprime(v[k]+k)); v \\ Charles R Greathouse IV, Apr 27 2023
  • Python
    from sympy import prevprime; L = [2]
    for _ in range(55): a = prevprime(L[-1] + len(L) + 1); L.append(a)
    print(*L, sep = ", ")
    

Formula

For n > 5, a(n) < n*(n-1)/2. I believe a(n) > n^2/2 + o(n^1.05) asymptotically (Baker, Harman & Pintz). - Charles R Greathouse IV, Apr 27 2023

A368241 a(n) = n - prevprime(n) if n is prime, n + primepi(n) otherwise; a(2) = 2.

Original entry on oeis.org

1, 2, 1, 6, 2, 9, 2, 12, 13, 14, 4, 17, 2, 20, 21, 22, 4, 25, 2, 28, 29, 30, 4, 33, 34, 35, 36, 37, 6, 40, 2, 43, 44, 45, 46, 47, 6, 50, 51, 52, 4, 55, 2, 58, 59, 60, 4, 63, 64, 65, 66, 67, 6, 70, 71, 72, 73, 74, 6, 77, 2, 80, 81, 82, 83, 84, 6, 87, 88, 89, 4, 92, 2, 95, 96
Offset: 1

Views

Author

Hendrik Kuipers, Dec 18 2023

Keywords

Comments

prevprime(n) = A151799(n) is the largest prime < n.
a(n) = 2 iff n=2 or n is the larger prime of a twin prime pair (A006512).

Crossrefs

Cf. A368196 (trajectories).

Programs

  • Mathematica
    Table[If[n<3, n, If[PrimeQ[n], n-NextPrime[n,-1], n+PrimePi[n]]],{n,75}] (* James C. McMahon, Dec 19 2023 *)
  • PARI
    a(n) = if (isprime(n), n - precprime(n-1), n + primepi(n)); \\ Michel Marcus, Dec 18 2023

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

A338409 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 A338215(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, 2, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 3, 2, 3, 4, 3, 4, 3, 4, 4, 4, 4, 6, 6, 5, 6, 4, 4, 6, 7, 7, 6, 7, 6, 5, 4, 6, 7, 8, 8, 8, 8, 10, 8, 8, 8, 9, 10, 8, 9, 11, 13, 11, 9, 12, 11, 10, 11, 11, 11, 13, 11, 14, 14, 13, 15, 17, 15, 16, 16, 16, 14, 14, 14
Offset: 0

Views

Author

Ya-Ping Lu, Oct 24 2020

Keywords

Examples

			The binary tree, read from left to right in the order of increasing depth n, is the positive integer sequence A000027. The first 67 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 \_67
All left children except 2 are composite numbers and all prime numbers are right children.
		

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

A339085 Number of primes p with n - pi(n) < p <= n + pi(n), where pi(n) is the number of primes <= n.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Nov 23 2020

Keywords

Comments

a(n) >= 2 if n >= 2 and a(n) >= 3 if n is a prime >= 3 (see the paper by Ya-Ping Lu attached in the links).

Crossrefs

Programs

  • Mathematica
    Table[PrimePi[n+PrimePi[n]]-PrimePi[n-PrimePi[n]],{n,85}] (* Stefano Spezia, Nov 24 2020 *)
  • Python
    from sympy import primepi
    for n in range(1, 101):
        m = primepi(n)
        print (primepi(n + m) - primepi(n - m))

Formula

a(n) = pi(n + pi(n)) - pi(n - pi(n)).
a(n) = A000720(n + A000720(n)) - A000720(n - A000720(n)).
a(n) = A000720(A095117(n)) - A000720(A062298(n)).
a(n) = A337788(n) + A338521(n) + isprime(n), where isprime(n) = 1 (if n is a prime) or 0 (if n is not a prime).
Previous Showing 11-17 of 17 results.