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

A121560 Lengths of blocks of zeros in sequence A121559.

Original entry on oeis.org

2, 1, 1, 3, 1, 3, 1, 3, 2, 2, 1, 2, 2, 3, 1, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 2, 2, 1, 2, 3, 1, 3, 1, 3, 2, 1, 1, 3, 2, 3, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 4, 2, 1, 1, 4, 3, 1, 3, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 1, 2, 2, 1, 1
Offset: 1

Views

Author

Kerry Mitchell, Aug 07 2006

Keywords

Examples

			a(1) = 2 because A121559 begins 1, 0, 0, 1, with 2 zeros between 1's.
		

Crossrefs

Cf. A121559.

A200947 Sequence A007924 expressed in decimal.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 16, 17, 18, 20, 32, 33, 64, 65, 66, 68, 128, 129, 256, 257, 258, 260, 512, 513, 514, 516, 517, 520, 1024, 1025, 2048, 2049, 2050, 2052, 2053, 2056, 4096, 4097, 4098, 4100, 8192, 8193, 16384, 16385, 16386, 16388, 32768, 32769, 32770
Offset: 0

Views

Author

Frank M Jackson, Nov 24 2011

Keywords

Examples

			8=7+1, hence A007924(8)=10001, so a(8)=17.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local m, p, r; m:=n; r:=0;
          while m>0 do
            if m=1 then r:=r+1; break fi;
            p:= prevprime(m+1); m:= m-p;
            r:= r+2^numtheory[pi](p)
          od; r
        end:
    seq(a(n), n=0..52);  # Alois P. Heinz, Jun 12 2023
  • Mathematica
    cprime[n_Integer] := If[n==0, 1, Prime[n]]; gentable[n_Integer] := (m=n; ptable={}; While[m != 0, (i = 0; While[cprime[i] <= m, i++]; j=0; While[j
    				

Formula

a(n) = decimal(A007924(n)).
a(n) mod 2 = A121559(n) for n>=1. - Alois P. Heinz, Jun 12 2023

Extensions

Edited by N. J. A. Sloane, May 20 2023

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

A175077 Final number reached by iterating r -> A049711(r) starting at r = n.

Original entry on oeis.org

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

Views

Author

Jaroslav Krizek, Jan 23 2010

Keywords

Comments

See A175071 for starting n that reach 1, and A175072 for starting n that reach 2.

Examples

			Iteration procedure for n = 6: 6 mod 5 = 1 = a(6).
Iteration procedure for n = 7: 7 mod 5 = 2 = a(7).
		

Crossrefs

Programs

  • Maple
    A151799 := proc(n) prevprime(n) ; end proc:
    A049711 := proc(n) if n <=2 then n; else n-A151799(n) ; end if; end proc:
    A175077 := proc(n) local r ; r := n ; while r > 2 do r := A049711(r) ; end do: r ; end proc:
    seq(A175077(n),n=1..100) ; # R. J. Mathar, Feb 19 2010
  • Mathematica
    f[n_] := Switch[n, 1, 1, 2, 2, _, n - NextPrime[n, -1]];
    a[n_] := FixedPoint[f, n];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jun 13 2023 *)

Formula

a(A175071(k)) = 1; a(A175072(k)) = 2, any k. - R. J. Mathar, Feb 19 2010
a(n) = A121559(n-1) + 1 for n >= 2. - Pontus von Brömssen, Jul 31 2022

Extensions

More terms from R. J. Mathar, Feb 19 2010

A175090 Composites c with result 0 under iterations of {r mod (max prime p <= r)} starting at r = c.

Original entry on oeis.org

9, 10, 15, 16, 21, 22, 25, 26, 28, 33, 34, 36, 39, 40, 45, 46, 49, 50, 52, 55, 56, 58, 63, 64, 66, 69, 70, 75, 76, 78, 81, 82, 85, 86, 88, 91, 92, 94, 96, 99, 100, 105, 106, 111, 112, 115, 116, 118, 120, 122, 123, 124, 126, 129, 130, 133, 134, 136, 141, 142
Offset: 1

Views

Author

Jaroslav Krizek, Jan 28 2010

Keywords

Comments

Intersection of A002808 and A175089.
Composites c such that A121559(c) = 0. - Michel Marcus, Aug 22 2014

Examples

			Iteration procedure for a(3) = 15: 15 mod 13 = 2, 2 mod 2 = 0.
		

Crossrefs

Cf. A007917 and A064722 (both for the iterations).

Programs

  • Maple
    g:= proc(x) if isprime(x) then 0 else x mod prevprime(x) fi end proc:
    f:= proc(x) local y; y:= x; while y > 1 do y:= g(y) od; y = 0 end proc:
    select(not(isprime) and f, [$4..200]); # Robert Israel, Feb 09 2015
  • Mathematica
    Composites := Select[Range[2, 200], ! PrimeQ[#] &]; Select[Composites, PrimeQ[# - NextPrime[#, -1]] &] (* Carlos Eduardo Olivieri, Feb 09 2015 *)

Extensions

Missing term 55 inserted, more terms added, Michel Marcus, Aug 22 2014

A175078 Number of iterations of {r mod (max prime p < r)} needed to reach 1 or 2 starting at r = n.

Original entry on oeis.org

0, 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
Offset: 1

Views

Author

Jaroslav Krizek, Jan 23 2010

Keywords

Comments

a(123) = 3 (first occurrence of value 3), a(1357324) = 4 (first occurrence of value 4). I offer a prize of 100 liters of Pilsner Urquell to the discoverer of value of first occurrence of value 5. See A175071 (natural numbers m with result 1) and A175072 (natural numbers m with result 2). See A175077 = results 1 or 2 under iterations of {r mod (max prime p < r)} starting at r = n.
Essentially the same as A121561. [R. J. Mathar, Jan 28 2010]
The function r mod (max prime p < r), which appears in the definition, equals r - (max prime p < r) = A049711(r), because p < r < 2*p by Bertrand's postulate, where p is the largest prime less than r. - Pontus von Brömssen, Jul 31 2022

Examples

			a(123) = 3; iteration procedure for n = 123: 123 mod 113 = 10, 10 mod 7 = 3, 3 mod 2 = 1.
		

Crossrefs

Programs

  • Mathematica
    Array[-1 + Length@ NestWhileList[Mod[#, NextPrime[#, -1]] &, #, Not[1 <= # <= 2] &, 1, 120] &, 105] (* Michael De Vlieger, Oct 30 2017 *)
  • PARI
    A175078(n) = if(n<=2,0,1+A175078(n%precprime(n-1))); \\ Antti Karttunen, Oct 30 2017

Formula

a(n) = A121561(n-1) for n >= 2, because the functions that are iterated (A049711 here, A064722 in A121561) satisfies A049711(r) = A064722(r-1) + 1. - Pontus von Brömssen, Jul 31 2022

Extensions

Name shortened by Antti Karttunen, Oct 30 2017

A175089 Numbers m with result 0 under iterations of {r mod (max prime p <= r)} starting at r = m.

Original entry on oeis.org

2, 3, 5, 7, 9, 10, 11, 13, 15, 16, 17, 19, 21, 22, 23, 25, 26, 28, 29, 31, 33, 34, 36, 37, 39, 40, 41, 43, 45, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 63, 64, 66, 67, 69, 70, 71, 73, 75, 76, 78, 79, 81, 82, 83, 85, 86, 88, 89, 91, 92, 94, 96, 97, 99, 100
Offset: 1

Views

Author

Jaroslav Krizek, Jan 28 2010

Keywords

Comments

Complement of A175088.
Union of A000040 (primes) and A175090. [Jaroslav Krizek, Feb 05 2010]
Numbers m such that A121559(m) = 0. - Michel Marcus, Aug 22 2014

Examples

			Iteration procedure for a(3) = 5: 5 mod 5 = 0.
Iteration procedure for a(5) = 9: 9 mod 7 = 2, 2 mod 2 = 0.
		

Crossrefs

Cf. A007917 and A064722 (both for the iterations).

Extensions

More terms from Michel Marcus, Aug 22 2014

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)

A175088 Numbers m with result 1 under iterations of {r mod (max prime p <= r)} starting at r = m.

Original entry on oeis.org

1, 4, 6, 8, 12, 14, 18, 20, 24, 27, 30, 32, 35, 38, 42, 44, 48, 51, 54, 57, 60, 62, 65, 68, 72, 74, 77, 80, 84, 87, 90, 93, 95, 98, 102, 104, 108, 110, 114, 117, 119, 121, 125, 128, 132, 135, 138, 140, 143, 145, 147, 150, 152, 155, 158, 161, 164, 168, 171
Offset: 1

Views

Author

Jaroslav Krizek, Jan 28 2010

Keywords

Comments

Terms are composites for all n >= 2.
Complement of A175089. [Jaroslav Krizek, Feb 05 2010]
Numbers m such that A121559(m) = 1. - Michel Marcus, Aug 22 2014

Examples

			Iteration procedure for a(6) = 14: 14 mod 13 = 1.
Iteration procedure for a(10) = 27: 27 mod 23 = 4, 4 mod 3 = 1.
		

Crossrefs

Cf. A007917 and A064722 (both for the iterations).

Programs

  • Mathematica
    (x /. Solve[Fold[Mod[#1, #2] &, x, Reverse[Prime /@ Range[40]]] == 1,
        x, Integers]) /. C[1] -> 0 (* Morgan L. Owens, Jun 22 2016 *)

Extensions

More terms from Michel Marcus, Aug 22 2014
Showing 1-9 of 9 results.