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

A381019 a(n) is the smallest positive integer not yet in the sequence such that a(n) is relatively prime to a(n-i) for all 1 <= i <= min(a(n), n-1).

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 4, 13, 17, 19, 23, 29, 9, 31, 37, 8, 41, 43, 47, 53, 59, 61, 6, 67, 71, 73, 79, 83, 89, 25, 97, 101, 103, 107, 109, 12, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 10, 173, 179, 181, 191, 193, 197, 199, 49, 211, 223, 227, 229, 233
Offset: 1

Views

Author

Ali Sada and Allan C. Wechsler, Feb 12 2025

Keywords

Comments

Theorem (Russ Cox, Feb 14-16, 2025): Every positive number will eventually appear. For proof see link.
Jinyuan Wang (Feb 16, 2025) has informed us that he also proved that every number appears.

Examples

			After a(2)=2, the next term that shares a common factor with 2 is a(7)=4, which is permitted since the difference 7-2 = 5 is greater than 4.
		

Crossrefs

A381167 is a different but closely related sequence.

Programs

  • Maple
    N:= 1000: # for terms before the first term > N
    Cands:= [$2..N]: R:= [1]: x:= 1:
    for n from 2 do
      found:= false;
      for j from 1 to N - n do
        if andmap(t -> igcd(t, Cands[j]) = 1, [seq(R[n-i],i=1 .. min(Cands[j],n-1))]) then
          found:= true; x:= Cands[j]; R:= [op(R),x]; Cands:= subsop(j=NULL,Cands); break
        fi od:
      if not found then break fi
    od:
    R; # Robert Israel, Feb 14 2025
  • Mathematica
    nn = 120; c[_] = False; u = v = 2; a[1] = 1;
    Do[k = u;
      While[Or[c[k],
        ! CoprimeQ[k, Product[a[h], {h, n - Min[k, n - 1], n - 1}] ] ],
        If[k > n - 1, k = v, k++]];
      Set[{a[n], c[k]}, {k, True}];
      If[k == u, While[c[u], u++]];
      If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}];
    Array[a, nn] (* Michael De Vlieger, Feb 14 2025 *)
  • Python
    # see link for faster version
    from math import gcd
    from itertools import count, islice
    def agen(): # generator of terms
        alst, aset, an, m = [1], {1}, 1, 2
        for n in count(2):
            yield an
            an = next(k for k in count(m) if k not in aset and all(gcd(alst[-j], k) == 1 for j in range(1, min(k, n-1)+1)))
            alst.append(an)
            aset.add(an)
            while m in aset: m += 1
    print(list(islice(agen(), 61))) # Michael S. Branicky, Feb 13 2025

Extensions

More terms from Michael S. Branicky, Feb 13 2025

A381116 Indices of composite terms in A381019.

Original entry on oeis.org

7, 13, 16, 23, 30, 36, 47, 55, 63, 64, 79, 91, 100, 113, 123, 142, 149, 167, 178, 196, 201, 223, 235, 256, 259, 279, 290, 325, 330, 346, 364, 382, 405, 422, 442, 468, 485, 488, 530, 534, 541, 583, 605, 630, 631, 665, 674, 682, 729, 735, 790, 798, 847, 854, 862
Offset: 1

Views

Author

N. J. A. Sloane, Feb 14 2025

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 1000; c[_] = False; u = v = 2; a[1] = 1;
    Monitor[Reap[
      Do[k = u;
        While[Or[c[k],
          ! CoprimeQ[k, Product[a[h], {h, n - Min[k, n - 1], n - 1}] ] ],
          If[k > n - 1, k = v, k++]];
        Set[{a[n], c[k]}, {k, True}];
        If[CompositeQ[k], Sow[n]];
        If[k == u, While[c[u], u++]];
    If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Feb 14 2025 *)
  • Python
    from math import gcd
    from sympy import isprime
    from itertools import count, islice
    def agen(): # generator of terms
        alst, aset, an, m = [1], {1}, 1, 2
        for n in count(2):
            if an > 3 and not isprime(an):
                yield n-1
            an = next(k for k in count(m) if k not in aset and all(gcd(alst[-j], k) == 1 for j in range(1, min(k, n-1)+1)))
            alst.append(an)
            aset.add(an)
            while m in aset: m += 1
    print(list(islice(agen(), 55))) # Michael S. Branicky, Feb 14 2025

A381117 Lengths of runs of consecutive primes in A381019.

Original entry on oeis.org

5, 5, 2, 6, 6, 5, 10, 7, 7, 14, 11, 8, 12, 9, 18, 6, 17, 10, 17, 4, 21, 11, 20, 2, 19, 10, 34, 4, 15, 17, 17, 22, 16, 19, 25, 16, 2, 41, 3, 6, 41, 21, 24, 33, 8, 7, 46, 5, 54, 7, 48, 6, 7, 5, 41, 13, 31, 18, 5, 50, 1, 49, 10, 26, 41, 24, 45, 53, 20, 21, 44, 3
Offset: 1

Views

Author

N. J. A. Sloane, Feb 14 2025

Keywords

Comments

For n > 1, a(n) = A381116(n) - A381116(n-1) - 1. (This is a trivial consequence of the definitions.)

Crossrefs

Programs

  • Mathematica
    nn = 500; c[_] = False; i = 0; u = v = 2; a[1] = 1;
    Monitor[Reap[
      Do[k = u;
        While[Or[c[k],
          ! CoprimeQ[k, Product[a[h], {h, n - Min[k, n - 1], n - 1}] ] ],
        If[k > n - 1, k = v, k++]];
        Set[{a[n], c[k]}, {k, True}];
        If[CompositeQ[k], Sow[i]; i = 0, i++];
        If[k == u, While[c[u], u++]];
    If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Feb 14 2025 *)

A381119 Index of n in A381019.

Original entry on oeis.org

1, 2, 3, 7, 4, 23, 5, 16, 13, 47, 6, 36, 8, 79, 63, 64, 9, 142, 10, 100, 113, 123, 11, 167, 30, 223, 91, 196, 12, 290, 14, 256, 201, 325, 149, 442, 15, 364, 330, 405, 17, 485, 18, 530, 534, 630, 19, 583, 55, 682, 382, 735, 20, 790, 346, 847, 259, 1034, 21, 1095
Offset: 1

Views

Author

N. J. A. Sloane, Feb 14 2025

Keywords

Comments

Every number does eventually appear in A381019 (see that sequence for proof).

Crossrefs

Extensions

More terms from Alois P. Heinz, Feb 14 2025

A381118 Index of 2^n in A381019.

Original entry on oeis.org

1, 2, 7, 16, 64, 256, 975, 3856, 16647, 65039, 260112, 1044504, 4177980, 16777224
Offset: 0

Views

Author

N. J. A. Sloane, Feb 14 2025

Keywords

Comments

Every power of 2 appears in A381019 (see that entry for proof).

Crossrefs

Extensions

a(7) from Michael S. Branicky, Feb 14 2025
a(8) from Michael S. Branicky, Feb 15 2025
a(9)-a(13) from Jinyuan Wang, Feb 16 2025
Showing 1-5 of 5 results.