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-10 of 15 results. Next

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

A346161 Prime numbers p such that the number of iterations of map A039634 required for p to reach 2 sets a new record.

Original entry on oeis.org

2, 3, 7, 23, 47, 191, 383, 1439, 2879, 11519, 23039, 261071, 1044287, 2949119, 31426559, 194224127, 1069493759, 8554807007, 31337349119, 68438456063, 136876912127, 547507648511, 8760122376191
Offset: 1

Views

Author

Ya-Ping Lu, Jul 08 2021

Keywords

Comments

It seems that the record number of iterations for a(n) is n-1.
Alternatively, prime numbers p such that the number of odd primes encountered under iteration of A004526 sets a new record. - Martin Ehrenstein, Aug 16 2021

Examples

			Terms in this sequence are indicated in square brackets in the tree below for primes up to 97. Note that a(n) is the smallest prime of depth n-1.
                 1                 ___________[2]____________
                 |                /        /   |   \    \    \
         _______[3]__       ____ 5 _     17   19   37   67   73
        /        |   \     /     |  \     |    |
     _[7]_      13   97   11    41  43   71   79
    /  |  \      |       /  \    |
  29  31  61    53    [23]  89  83
   |                    |
  59                  [47]
		

Crossrefs

Programs

  • Python
    from sympy import nextprime, isprime
    rec = -1; p1 = 1
    while p1 < 1000000000:
        p = nextprime(p1); m = p; ct = 0
        while m > 2:
            if isprime(m): ct += 1
            m //= 2
        if ct > rec: print(p); rec = ct
        p1 = p

Extensions

a(19)-a(23) from Martin Ehrenstein, Aug 22 2021

A039645 Number of steps to fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)+1.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039645 n = snd $ until ((== 1) . a010051 . fst)
                (\(x, i) -> ((x + 1) `div` 2 , i + 1)) (a000040 n + 1, 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    f[k_] := Which[PrimeQ[k], k, EvenQ[k], k/2, True, (k+1)/2];
    a[n_] := Length[FixedPointList[f, Prime[n] + 1]] - 1;
    Array[a, 102] (* Jean-François Alcover, Mar 01 2019 *)

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039636 Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime".

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039636 1 = 1
    a039636 n = snd $ until ((== 1) . a010051 . fst)
                            (\(x, i) -> (x `div` 2 , i + 1)) (n, 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    nerlist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&&#>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#-1)/2 ] ]&, n, 20 ], -1 ]

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039635 Fixed point of "n -> n/2 or (n+1)/2 until result is prime".

Original entry on oeis.org

1, 2, 3, 2, 5, 3, 7, 2, 5, 5, 11, 3, 13, 7, 2, 2, 17, 5, 19, 5, 11, 11, 23, 3, 13, 13, 7, 7, 29, 2, 31, 2, 17, 17, 5, 5, 37, 19, 5, 5, 41, 11, 43, 11, 23, 23, 47, 3, 13, 13, 13, 13, 53, 7, 7, 7, 29, 29, 59, 2, 61, 31, 2, 2, 17, 17, 67, 17, 5, 5, 71, 5, 73, 37, 19, 19, 5, 5, 79, 5, 41
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039635 1 = 1
    a039635 n = until ((== 1) . a010051) ((flip div 2) . (+ 1)) n
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    upp[ n_Integer ] := FixedPoint[ If[ EvenQ[ # ]&&#>2, #/2, If[ PrimeQ[ # ]||(#=== 1), #, (#+1)/2 ] ]&, n, 20 ]

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039637 Number of steps to fixed point of "n -> n/2 or (n+1)/2 until result is prime".

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039637 1 = 1
    a039637 n = snd $ until ((== 1) . a010051 . fst)
                            (\(x, i) -> ((x + 1) `div` 2 , i + 1)) (n, 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    upplist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&&#>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#+1)/2 ] ]&, n, 20 ], -1 ]

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039644 Number of steps to fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)-1.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039644 1 = 1
    a039644 n = snd $ until ((== 1) . a010051 . fst)
                (\(x, i) -> ((x + 1) `div` 2 , i + 1)) (a000040 n - 1, 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    (* See A039637. *)

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A078833 Greatest prime contained as binary substring in binary representation of n>1, a(1)=1.

Original entry on oeis.org

1, 2, 3, 2, 5, 3, 7, 2, 2, 5, 11, 3, 13, 7, 7, 2, 17, 2, 19, 5, 5, 11, 23, 3, 3, 13, 13, 7, 29, 7, 31, 2, 2, 17, 17, 2, 37, 19, 19, 5, 41, 5, 43, 11, 13, 23, 47, 3, 17, 3, 19, 13, 53, 13, 23, 7, 7, 29, 59, 7, 61, 31, 31, 2, 2, 2, 67, 17, 17, 17, 71, 2, 73, 37, 37, 19, 19, 19, 79, 5, 17
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 08 2002

Keywords

Comments

a(n) = A039634(n) for n<=44, but a(45) = 13 <> 11 = A039634(45);
for n>1: a(n) = n iff n is prime.
a(n) = A225243(n, A078826(n)). - Reinhard Zumkeller, Aug 14 2013

Examples

			n=12 -> '1100' contains 2 binary substrings which are primes: '11' (11bb) and '10' (b11b); 3='11' is the greater one, therefore a(12)=3.
		

Crossrefs

Programs

A039638 Fixed point of "k -> k/2 or (k-1)/2 until result is prime", starting with prime(n)-1.

Original entry on oeis.org

1, 2, 2, 3, 5, 3, 2, 2, 11, 7, 7, 2, 5, 5, 23, 13, 29, 7, 2, 17, 2, 19, 41, 11, 3, 3, 3, 53, 13, 7, 31, 2, 17, 17, 37, 37, 19, 5, 83, 43, 89, 11, 47, 3, 3, 3, 13, 13, 113, 7, 29, 59, 7, 31, 2, 131, 67, 67, 17, 17, 17, 73, 19, 19, 19, 79, 41, 5, 173, 43, 11, 179, 11, 23, 47, 191
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039638 1 = 1
    a039638 n = until ((== 1) . a010051) (flip div 2) (a000040 n - 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    (* See A039634. *)
    Table[NestWhile[If[EvenQ[#],#/2,(#-1)/2]&,Prime[n]-1,CompositeQ],{n,80}] (* Harvey P. Dale, May 27 2023 *)

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039639 Fixed point of "k -> k/2 or (k-1)/2 until result is prime", starting with prime(n)+1.

Original entry on oeis.org

3, 2, 3, 2, 3, 7, 2, 5, 3, 7, 2, 19, 5, 11, 3, 13, 7, 31, 17, 2, 37, 5, 5, 11, 3, 3, 13, 13, 13, 7, 2, 2, 17, 17, 37, 19, 79, 41, 5, 43, 11, 11, 3, 97, 3, 3, 53, 7, 7, 7, 29, 7, 7, 31, 2, 2, 67, 17, 139, 17, 71, 73, 19, 19, 157, 79, 83, 5, 43, 43, 11, 11, 23, 23, 47, 3, 97, 199, 3
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039639 = until ((== 1) . a010051) (flip div 2) . (+ 1) . a000040
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    (* See A039634. *)

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013
Showing 1-10 of 15 results. Next