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

A346063 a(n) = primepi(A039634(prime(n)^2-1)).

Original entry on oeis.org

2, 1, 2, 2, 4, 3, 1, 5, 1, 6, 4, 3, 6, 4, 7, 14, 6, 10, 7, 37, 23, 25, 28, 18, 21, 22, 67, 24, 9, 46, 11, 19, 62, 12, 40, 24, 2, 27, 6, 91, 11, 31, 20, 1, 36, 203, 69, 25, 2, 80, 16, 48, 155, 18, 1, 326, 7, 20, 109, 365, 8, 39, 9, 240, 438, 2, 16, 154, 10, 17
Offset: 1

Views

Author

Ya-Ping Lu, Jul 03 2021

Keywords

Comments

This sequence looks at the effect on p^2 - 1 of A039634 with the primes represented by their indices. It seems that primes obtained by iterating the map A039634 on p^2 - 1 never fall into a cycle before reaching 2. Conjecture: Iterating the map k -> a(k) eventually reaches 1. For example, 1 -> 2 -> 1; 5 -> 4 -> 2 -> 1; and 27 -> 67 -> 16 -> 14 -> 4 -> 2 -> 1.
If the conjecture holds, then A339991(n) != -1 and A340419 is a finite sequence.

Crossrefs

Programs

  • Mathematica
    Array[PrimePi@ FixedPoint[If[EvenQ[#] && # > 2, #/2, If[PrimeQ[#] || (# === 1), #, (# - 1)/2]] &, Prime[#]^2 - 1] &, 70] (* Michael De Vlieger, Jul 06 2021 *)
  • Python
    from sympy import prime, isprime, primepi
    def a(n):
        p = prime(n); m = p*p - 1
        while not isprime(m): m = m//2
        return primepi(m)
    for n in range(1, 71): print(a(n))

Formula

a(n) = A000720(A039634(A000040(n)^2-1)). - Pontus von Brömssen, Jul 03 2021

A340801 a(n) is the image of n under the map f defined as f(n) = n^2 - 2 if n is an odd prime, f(n) = n/2 if n is even, and f(n) = n - 1 otherwise.

Original entry on oeis.org

0, 1, 7, 2, 23, 3, 47, 4, 8, 5, 119, 6, 167, 7, 14, 8, 287, 9, 359, 10, 20, 11, 527, 12, 24, 13, 26, 14, 839, 15, 959, 16, 32, 17, 34, 18, 1367, 19, 38, 20, 1679, 21, 1847, 22, 44, 23, 2207, 24, 48, 25, 50, 26, 2807, 27, 54, 28, 56, 29, 3479, 30, 3719, 31, 62
Offset: 1

Views

Author

Ya-Ping Lu, Jan 21 2021

Keywords

Comments

Conjecture 1: Iterating map f on an integer n (n > 1) results in a different integer, or f^i(n) != f^j(n) if i != j, where f^i(n) and f^j(n) are the i-th and j-th iterations of map f on n respectively.
Conjecture 2: An integer n eventually reaches 1 when map f is applied to n repeatedly.

Crossrefs

Programs

  • PARI
    a(n) = if (n%2, if (isprime(n), n^2-2, n-1), n/2); \\ Michel Marcus, Jan 22 2021
  • Python
    from sympy import isprime
    for n in range(1, 101):
        if isprime(n) == 1 and n != 2: a = n*n - 2
        elif n%2 == 0: a = n/2
        else: a = n - 1
        print(a)
    

Formula

a(2*k+1) = 2*a(2*k) if 2*k+1 is not a prime.
a(2*k+2) = a(2*k) + 1, where k >= 1.

A341742 Nodes read by depth in a binary tree defined as: Root = 1; an even node N has a left child N + 1 if N + 1 is not a prime, and an odd node N has a left child sqrt(N + 2) if sqrt(N + 2) is a prime; the right child of a node N is 2*N.

Original entry on oeis.org

1, 2, 4, 8, 9, 16, 18, 32, 36, 33, 64, 72, 66, 65, 128, 144, 132, 130, 129, 256, 145, 288, 133, 264, 260, 258, 512, 290, 289, 576, 266, 265, 528, 261, 520, 259, 516, 513, 1024, 291, 580, 578, 1152, 267, 532, 530, 529, 1056, 522, 1040, 518, 517, 1032, 1026
Offset: 1

Views

Author

Ya-Ping Lu, Feb 18 2021

Keywords

Comments

Let d be the depth of a node N in the binary tree and f be the map of A340801. The d-th iteration of map A340801 on N gives 1, or f^d(N) = 1.
If Conjectures 1 and 2 made in A340801 hold, the sequence contains all positive integers and each integer appears once in the sequence.
The first odd prime does not appear until d reaches 30 and the first five odd primes appearing in the sequence are:
n a(n) d
------- ----- --
140735 4099 30
151872 1543 31
1574120 8689 36
1841645 2917 36
2111465 32771 36
The first two odd primes less than 100 appear in the binary tree are 17 at d = 4426 and 71 at d = 4421.

Examples

			The binary tree for depths up to 9 is given below.
  1
   \
    2
     \
      4
       \
        8
     /    \
   9       16
    \        \
    18        32
     \       /  \
     36    33    64
      \     \    / \
      72    66  65  128
       \     \   \   / \
      144   132 130 129 256
      / \   / \   \   \   \
   145 288 133 264 260 258 512
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    from math import sqrt
    def children(N):
        C = []
        if N%2 == 0:
            if isprime(N + 1) == 0: C.append(N+1)
        else:
            p1 = sqrt(N + 2.0); p2 = int(p1 + 0.5)
            if p2**2 == N + 2 and isprime(p2) == 1: C.append(p2)
        C.append(2*N)
        return C
    L_last = [1]; print(L_last)
    for d in range(1, 18):
        L_1 = []
        for i in range(0, len(L_last)):
            C_i = children(L_last[i])
            for j in range(0, len(C_i)): L_1.append(C_i[j])
        print(L_1); L_last = L_1

A346136 a(n) is the number of iterations that n requires to reach 1 under the map n -> A346063(n).

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 1, 4, 1, 4, 3, 3, 4, 3, 2, 4, 4, 5, 2, 3, 9, 11, 8, 6, 10, 12, 6, 7, 2, 8, 4, 3, 6, 4, 10, 7, 2, 7, 4, 9, 4, 5, 4, 1, 8, 7, 6, 11, 2, 73, 5, 12, 5, 6, 1, 5, 2, 4, 34, 7, 5, 5, 2, 51, 7, 2, 5, 3, 5, 5, 3, 15, 6, 5, 2, 4, 10
Offset: 1

Views

Author

Ya-Ping Lu, Jul 05 2021

Keywords

Comments

Conjecture: the sequence is infinite.

Crossrefs

Programs

  • PARI
    f(x) = my(k=x^2-1); while(k>3 && !ispseudoprime(k), k\=2); k;
    a(n) = my(c=0, x=prime(n)); while(x>2, c++; x=f(x)); c; \\ Jinyuan Wang, Jul 15 2022
  • Python
    from sympy import prime, isprime
    for n in range(1, 78):
        m = prime(n); ct = 0
        while m > 2:
            if isprime(m): m = m*m - 1; ct += 1
            else: m //= 2
        print(ct)
    

Extensions

a(1) corrected by Jinyuan Wang, Jul 15 2022
Showing 1-4 of 4 results.