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

A039640 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, 5, 11, 7, 2, 5, 5, 11, 23, 13, 29, 2, 17, 5, 5, 5, 41, 11, 3, 13, 13, 53, 7, 7, 2, 17, 17, 5, 37, 19, 5, 41, 83, 43, 89, 23, 3, 3, 13, 13, 53, 7, 113, 29, 29, 2, 2, 2, 2, 131, 67, 17, 5, 5, 71, 73, 5, 5, 5, 79, 83, 11, 173, 11, 11, 179, 23, 47, 3, 191, 97, 13
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

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

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039641 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, 5, 5, 3, 2, 2, 19, 11, 11, 3, 7, 2, 31, 17, 5, 37, 5, 11, 23, 13, 13, 13, 7, 7, 29, 2, 17, 5, 5, 19, 19, 79, 41, 11, 11, 23, 23, 3, 97, 13, 13, 53, 7, 29, 29, 59, 2, 61, 2, 17, 17, 17, 17, 139, 71, 71, 37, 5, 5, 157, 5, 83, 43, 11, 11, 89, 23, 23, 47, 3, 3, 13
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039641 = until ((== 1) . a010051) (flip div 2 . (+ 1)) . (+ 1) . a000040
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    (* See A039635. *)
    Table[NestWhile[If[EvenQ[#],#/2,(#+1)/2]&,n+1,!PrimeQ[#]&],{n,Prime[ Range[ 80]]}] (* Harvey P. Dale, May 12 2014 *)

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039642 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, 4, 2, 3, 3, 5, 4, 4, 2, 3, 2, 4, 6, 3, 6, 3, 2, 4, 6, 6, 6, 2, 4, 5, 3, 7, 4, 4, 3, 3, 4, 6, 2, 3, 2, 5, 3, 7, 7, 7, 5, 5, 2, 6, 4, 3, 6, 4, 8, 2, 3, 3, 5, 5, 5, 3, 5, 5, 5, 3, 4, 7, 2, 4, 6, 2, 6, 5, 4, 2, 3, 8, 8, 8, 6, 6, 3, 6, 3, 6, 7, 7, 7, 7, 2, 2, 7, 4, 5, 2, 3, 9, 9, 4, 6, 3
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

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

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A039643 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, 4, 3, 4, 3, 5, 2, 4, 3, 5, 3, 4, 2, 3, 6, 2, 5, 5, 4, 6, 6, 4, 4, 4, 5, 7, 7, 4, 4, 3, 4, 2, 3, 6, 3, 5, 5, 7, 2, 7, 7, 3, 6, 6, 6, 4, 6, 6, 4, 8, 8, 3, 5, 2, 5, 3, 3, 5, 5, 2, 3, 3, 7, 4, 4, 6, 6, 5, 5, 4, 8, 3, 2, 8, 8, 6, 2, 6, 6, 6, 6, 7, 2, 7, 5, 5, 7, 4, 4, 5, 5, 3, 9, 3, 2, 3, 3
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

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

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013

A331044 a(n) is the greatest prime number of the form floor(n/10^k) for some k >= 0, or 0 if no such prime number exists.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 08 2020

Keywords

Comments

In other words, a(n) is the greatest prime prefix of n, or 0 if every prefix of n is nonprime.
This sequence is a decimal variant of A039634.

Examples

			For n = 42:
- neither 42 nor 4 is a prime number,
- hence a(42) = 0.
For n = 290:
- 290 is not a prime number,
- 29 is a prime number,
- hence a(290) = 29.
		

Crossrefs

See A331045 for a similar sequence.

Programs

  • Mathematica
    A331044[n_] := NestWhile[Quotient[#, 10] &, n, # > 0 && !PrimeQ[#] &];
    Array[A331044, 100, 0] (* Paolo Xausa, Nov 22 2024 *)
  • PARI
    a(n, base=10) = while (n, if (isprime(n), return (n), n\=base)); 0

Formula

a(n) <= n with equality iff n = 0 or n is a prime number.
a(n) >= 0 with equality iff n belongs to A202259.
Previous Showing 11-15 of 15 results.