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.

A121561 The number of iterations of "subtract the largest prime less than or equal to the current value" to go from n to the limiting value 0 or 1.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Kerry Mitchell, Aug 07 2006

Keywords

Comments

Number of steps to go from n to A121559(n).
The sequence has the form of blocks of numbers; see A121562 for the lengths of those blocks.

Examples

			a(9) = 2 because there are 2 steps in going from 9 to 0 in A121559: 9 mod 7 = 2 and 2 mod 2 = 0.
		

Crossrefs

Cf. A121559, A064722, a(n)=1: A093515, a(n)=2: A093513, a(n)=3: A138026, a(n)=4: A138027.

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]; Array[f, 105] (* Robert G. Wilson v, Feb 29 2008 *)
  • Python
    from sympy import prevprime
    def a(n): return 0 if n == 0 or n == 1 else 1 + a(n - prevprime(n+1))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 26 2022

A138026 Numbers k where A121561(k) = 3.

Original entry on oeis.org

122, 123, 148, 190, 208, 209, 220, 221, 250, 292, 302, 303, 326, 327, 346, 418, 430, 476, 477, 518, 519, 532, 533, 538, 539, 556, 586, 628, 629, 640, 670, 671, 700, 718, 782, 783, 796, 806, 807, 820, 838, 848, 849, 872, 873, 896, 897, 902, 903, 928, 962
Offset: 1

Views

Author

Robert G. Wilson v, Feb 27 2008

Keywords

Crossrefs

Programs

  • Maple
    filter:= proc(n)
      local t;
      t:= n-prevprime(n+1);
      if t <= 1 then return false fi;
      t:= t-prevprime(t+1);
      if t <= 1 then return false fi;
      isprime(t) or isprime(t-1)
    end proc:
    select(filter,[$2..1000]); # Robert Israel, Jan 15 2019
  • 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 = {}; Do[ If[f@n == 3, AppendTo[lst,n]], {n, 10^3}]; lst
Showing 1-2 of 2 results.