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

A135543 Record number of steps under iterations of "map n to n - (largest prime <= n)" (A064722) until reaching the limiting value 0 or 1. Also, places where A121561 reaches a new record.

Original entry on oeis.org

1, 2, 9, 122, 1357323
Offset: 0

Views

Author

Sergio Pimentel, Feb 22 2008

Keywords

Comments

a(5) must be very large (> 100000000). Can anyone extend the sequence?
Conjecture: there exist positive values of n for which a(n) != A175079(n) - 1. - Jaroslav Krizek, Feb 05 2010
From Thomas R. Nicely's data (see link) it seems that the smallest known prime with following prime gap of length a(4)+1 or more is 90823#/510510 - 1065962 (39279 digits), so a(5) = A104138(a(4)) + a(4) <= 90823#/510510 - 1065962 + 1357323 = A002110(8787)/510510 + 291361. (The bounding primes of this prime gap are only known to be probable primes, but if either of them were not prime, the gap would only be larger and the bound on a(5) would still hold.) - Pontus von Brömssen, Jul 31 2022

Examples

			a(4) = 1357323 because after iterating n - (largest prime <= n) we get:
  1357323 - 1357201 = 122 =>
  122 - 113 = 9 =>
  9 - 7 = 2 =>
  2 - 2 = 0,
which takes 4 steps.
		

Crossrefs

Programs

  • Mathematica
    LrgstPrm[n_] := Block[{k = n}, While[ !PrimeQ@ k, k-- ]; k]; f[n_] := Block[{c = 0, d = n}, While[d > 1, d = d - LrgstPrm@d; c++ ]; c]; lst = {}; record = -1; Do[ a = f@n; If[a > record, record = a; AppendTo[lst, a]; Print@ n], {n, 100}] (* Robert G. Wilson v *)
  • Python
    from sympy import prevprime
    from functools import lru_cache
    from itertools import count, islice
    @lru_cache(maxsize=None)
    def f(n): return 0 if n == 0 or n == 1 else 1 + f(n - prevprime(n+1))
    def agen(record=-1):
        for k in count(1):
            if f(k) > record: record = f(k); yield k
    print(list(islice(agen(), 4))) # Michael S. Branicky, Jul 26 2022

Formula

Iterate n - (largest prime <= n) until reaching 0 or 1. Count the iterations required to reach 0 or 1 and determine if it is a new record.
From Pontus von Brömssen, Jul 31 2022: (Start)
a(n) = A104138(a(n-1)) + a(n-1) for n >= 2.
A121561(a(n)) = n.
a(n) = A175079(n) - 1 for n >= 1, i.e., the conjecture in the Comments is false. This follows from the result that A175078(n) = A121561(n-1) for n >= 2.
(End)

A175079 The smallest natural numbers m with first occurrence 0, 1, 2, 3, ... for number of steps of iterations of {r mod (max prime p < r)} needed to reach 1 or 2 starting at r = m.

Original entry on oeis.org

1, 3, 10, 123, 1357324
Offset: 0

Views

Author

Jaroslav Krizek, Jan 23 2010

Keywords

Comments

I offer a prize of 100 liters of Pilsner Urquell to the discoverer of a(5). Conjecture: a(n) is not equal A135543(n) + 1 for all n >= 1. See A175071 (natural numbers m with result 1) and A175072 (natural numbers m with result 2). See A175077 (results 1 or 2 under iterations) and A175078 (number of steps of iterations).

Examples

			Iteration for a(4) = 1357324 has 4 steps: 1357324 mod 1357201 = 123, 123 mod 113 = 10, 10 mod 7 = 3, 3 mod 2 = 1.
		

Crossrefs

Formula

From Pontus von Brömssen, Jul 31 2022: (Start)
a(n) = A135543(n) + 1 for n >= 1, i.e., the conjecture in the Comments is false. This follows from the result that A175078(n) = A121561(n-1) for n >= 2.
a(5) = A135543(5) + 1 <= A002110(8787)/510510 + 291362 (see comment in A135543).
(End)

Extensions

Jaroslav Krizek, Jan 30 2010
Showing 1-2 of 2 results.