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

A375564 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that is coprime to a(n-1) if a(n-1) is prime, otherwise a(n) shares a factor with a(n-1).

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 10, 5, 7, 9, 12, 14, 16, 18, 15, 20, 22, 11, 13, 17, 19, 21, 24, 26, 28, 30, 25, 35, 40, 32, 34, 36, 27, 33, 39, 42, 38, 44, 46, 23, 29, 31, 37, 41, 43, 45, 48, 50, 52, 54, 51, 57, 60, 55, 65, 70, 49, 56, 58, 62, 64, 66, 63, 69, 72, 68, 74, 76, 78, 75, 80, 82, 84, 77, 88, 86, 90
Offset: 1

Views

Author

Scott R. Shannon, Aug 19 2024

Keywords

Comments

The sequence contains groups of consecutive primes separated by groups of composite terms. See the attached images of the first 100000 and 25 million terms.
The fixed points are 1, 2, 3, 4, 15, 51, 63, 363, 437, ... There are thirty-two fixed points in the first 100000 terms and it is likely there are infinitely many in total. The sequence is conjectured to be a permutation of the positive integers.
Theorem: This sequence is a permutation of the positive integers, and the primes appear in their natural order. See link for proof. - N. J. A. Sloane, Sep 24 2024 and Oct 02 2024

Examples

			a(8) = 7 as a(7) = 5 is a prime number, and 7 is the smallest unused number that is coprime to 5.
Comment from _N. J. A. Sloane_, Oct 02 2024 (Start)
The following table was calculated by _Scott R. Shannon_ on Sep 29 2024. It shows the beginning, end, and length of the k-th run of successive primes.
  a  b c  : d e f [a = k, b = A376192(k), c = A376193(k),
  1  2 2  : 3 3 2   d = A376196, e = A376197, f = A376195]
  2  8 5  : 9 7 2
  3  18 11  : 21 19 4
  4  40 23  : 45 43 6
  5  84 47  : 92 83 9
  6  162 89  : 177 167 16
  7  321 173  : 351 349 31
  8  649 353  : 702 683 54
  9  1286 691  : 1379 1361 94
  10  2550 1367  : 2724 2699 175
  11  5096 2707  : 5412 5387 317
  12  10188 5393  : 10787 10739 600
  13  20406 10753  : 21502 21467 1097
  14  40883 21481  : 42958 42863 2076
  15  81932 42899  : 85791 85717 3860
  16  164190 85733  : 171441 171103 7252
  17  328490 171131  : 342216 341729 13727
  18  657509 341743  : 683462 682811 25954
  19  1316258 682819  : 1365580 1364747 49323
  20  2635513 1364761  : 2729447 2728129 93935
  21  5276876 2728163  : 5456194 5454167 179319
  22  10565366 5454181  : 10908253 10906271 342888
  23  21155215 10906297  : 21812343 21808453 657129
  24  42355195 21808483  : 43616683 43611721 1261489
  25  84797387 43611731  : 87223016 87215467 2425630
  26  169759097 87215483  : 174430392 174419101 4671296
(End)
		

Crossrefs

Programs

  • Mathematica
    nn = 120; c[_] := False; Do[Set[{a[i], c[i]}, {i, True}], {i, 2}];
    j = a[2]; u = 3;
    Do[k = u; If[PrimeQ[j],
        While[Or[c[k], GCD[j, k] > 1], k++],
        While[Or[c[k], CoprimeQ[j, k]], k++]];
      Set[{a[i], c[k], j}, {k, True, k}];
      If[k == u, While[c[u], u++]], {i, 3, nn}];
    Array[a, nn] (* Michael De Vlieger, Sep 29 2024 *)
  • Python
    from itertools import islice
    from math import gcd
    from sympy import isprime
    def A375564_gen(): # generator of terms
        aset, a, b = {1,2}, 2, 3
        yield from (1,2)
        while True:
            c = b
            if isprime(a):
                while c in aset or gcd(c,a)>1:
                    c+=1
            else:
                while c in aset or gcd(c,a)==1:
                    c+=1
            aset.add(c)
            yield (a:=c)
            while b in aset:
                b += 1
    A375564_list = list(islice(A375564_gen(),20)) # Chai Wah Wu, Sep 30 2024

A379248 a(1) = 1, a(2) = 2, for a(n) > 2, a(n) is the smallest unused positive number that shares a factor with a(n-1) while no exponent of each distinct prime factor of a(n) is the same as the exponent of the same prime factor of a(n-1).

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 9, 3, 18, 15, 25, 5, 50, 16, 14, 20, 22, 24, 26, 28, 30, 27, 21, 36, 32, 34, 40, 38, 44, 42, 45, 33, 54, 39, 63, 48, 46, 52, 56, 49, 7, 98, 35, 75, 55, 100, 58, 60, 62, 64, 66, 68, 70, 72, 51, 81, 57, 90, 69, 99, 78, 76, 74, 80, 82, 84, 86, 88, 92, 94, 96, 104, 102, 108, 87, 117, 93, 126, 111, 135, 114, 112, 106, 116, 110, 121, 11, 242
Offset: 1

Views

Author

Scott R. Shannon, Dec 18 2024

Keywords

Comments

For the terms studied the primes appear as terms in their natural order, and when a prime p appears as a term, the preceding term is always p^2 and the following term is always 2*p^2; it is likely this is true for all primes. A similar pattern is seen in the EKG sequence A064413 except that there a prime is always preceded by 2*p and followed by 3*p.
Unlike the EKG sequence a prime can appear as a factor of a preceding term long before it appears as a term by itself - see A379291 for the indices where each prime first appears as a factor of a(n).
The indices where the primes appear show an interesting pattern of runs of consecutive primes that are separated by only 6 terms, with longer, sometimes much longer, gaps in between - see A379290 and A379296. These primes appear in regions where the terms overall show a strong oscillating pattern of jumping between terms containing a prime p and p^2 as a factor. The primes being oscillated between increase until a new prime q appears in a term q^2 which leads to the next term being q. The occurrence of a new prime q can start a run of consecutive primes appearing before these oscillations subside and the terms slowly grow again until the next oscillation. See the attached graphs which show the burst/oscillating behavior, with the primes appearing in these regions, followed by terms with a slow, more linear, growth.
In the first 500000 terms there are only six fixed points - see A379292. However, as the regions of oscillating terms crosses the a(n) = n line it is likely more exist for larger values of n.
The sequence is conjectured to be a permutation of the positive integers. See A379293 for the index where n first appears.

Examples

			a(3) = 4 as 4 is unused and shares a factor with a(2) = 2, while 4 = 2^2 which has 2 as the exponent of the prime 2, while a(2) = 2^1 which has exponent 1. As these are different 4 is acceptable.
a(5) = 8 as 8 is unused and shares a factor with a(4) = 6, while 8 = 2^3 which has 3 as the exponent of the prime 2, while a(4) = 2^1*3^1 which has exponent 1. As these are different 8 is acceptable. Note that although 3 shares a factor with 6, 3 = 3^1 which has the same exponent 1 on the prime 3 as 6 = 2^1*3^1, so 3 cannot be chosen. This is the first term to differ from A064413.
		

Crossrefs

Cf. A379290 (index where prime n appears as a term), A379296 (differences between indices where prime terms appear), A379291 (index where prime n first appears as a factor of a(n)), A379293 (index where n appears as a term), A379292 (fixed points), A379294 (record high values), A379295 (indices of record high values).

Programs

  • Mathematica
    nn = 120; c[_] := False;
    f[x_] := f[x] = FactorInteger[x]; j = 2; u = 3;
    {1, 2}~Join~Reap[Do[
      k = u; While[Or[c[k], CoprimeQ[j, k], AnyTrue[f[k], MemberQ[f[j], #] &]], k++];
        Set[{j, c[k]}, {k, True}]; Sow[k];
    If[k == u, While[c[u], u++]], {n, 3, nn}] ][[-1, 1]] (* Michael De Vlieger, Dec 21 2024 *)
  • Python
    from sympy import factorint
    from itertools import islice
    from collections import Counter
    fcache = dict()
    def myfactors(n):
        global fcache
        if n in fcache: return fcache[n]
        ans = Counter({p:e for p, e in factorint(n).items()})
        fcache[n] = ans
        return ans
    def agen(): # generator of terms
        yield 1
        an, a, m = 2, {1, 2}, 3
        while True:
            yield an
            k, fan = m-1, myfactors(an)
            sfan = set(fan)
            while True:
                k += 1
                if k in a: continue
                fk = myfactors(k)
                sfk = set(fk)
                if sfk & sfan and all(fk[p]!=fan[p] for p in sfan):
                    an = k
                    break
            a.add(an)
    print(list(islice(agen(), 89))) # Michael S. Branicky, Jan 05 2025

A373545 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that shares a factor with a(n-1) if a(n-1) is odd otherwise is coprime to a(n-1) if a(n-1) is even.

Original entry on oeis.org

1, 2, 3, 6, 5, 10, 7, 14, 9, 12, 11, 22, 13, 26, 15, 18, 17, 34, 19, 38, 21, 24, 23, 46, 25, 20, 27, 30, 29, 58, 31, 62, 33, 36, 35, 28, 37, 74, 39, 42, 41, 82, 43, 86, 45, 40, 47, 94, 49, 56, 51, 48, 53, 106, 55, 44, 57, 54, 59, 118, 61, 122, 63, 60, 67, 134, 65, 50, 69, 66, 71, 142, 73, 146
Offset: 1

Views

Author

Scott R. Shannon, Jun 09 2024

Keywords

Comments

The terms studied are all concentrated along lines of different gradient; the odd terms all being on the line a(n) = n or very close to it, while the even terms are distributed among the other lines dependent on the number of prime factors they contain. It is conjectured that this behavior is true for all n. The topmost line contains even semiprimes while the lower lines, those with gradient less than 1, contain powers of 2 multiplied by a larger single prime. However the topmost of these lower lines, which is more diffuse, also contains all other even numbers. Also noticeable is some of the lower lines terminating after which these values appear to move into the line contains all other even numbers.
Many odd terms are fixed points, this not occurring only when such a number would share a factor with the previous even number. This first occurs at a(65) = 67, when 65 cannot be chosen as it would share a factor with a(64) = 60.
The term selection rules would allow for consecutive odd numbers although this never occurs in the terms studied and is unlikely to ever occur. Likewise for the terms studied all primes appear in their natural order. No power of 2, other than 2 itself, can be a term.
From Michael De Vlieger, Jun 11 2024: (Start)
Conjecture: Odd prime p precedes 2*p.
Conjecture: Odd prime p appears for odd n, but additionally, tends to occupy a(n) such that n mod A002110(k) is a reduced residue of the largest A002110(k) < n. Thus, a(n) = p for n <= p. Example, a(65) = 67 is displaced. However, generally primes represent fixed points. (End)

Examples

			a(7) = 7 as a(6) = 10 is an even number and 7 is the smallest unused positive that is coprime to 10.
		

Crossrefs

Programs

  • Mathematica
    kk = 2; nn = 120; c[_] := False; Array[Set[{a[#], c[#]}, {#, True}] &, kk];
    j = a[kk]; u = kk + 1;
    Do[If[OddQ[j],
       If[PrimePowerQ[j],
         p = FactorInteger[j][[1, 1]];
           k = #1 + Boole[#2 > 0] & @@ QuotientRemainder[u, p];
           While[c[k  p], k++]; k *= p,
         k = u; While[Or[c[k], CoprimeQ[j, k]], k++]],
       k = u; While[Or[c[k], ! CoprimeQ[j, k]], k++] ];
      Set[{a[n], c[k], j}, {k, True, k}];
      If[k == u, While[c[u], u++]], {n, kk + 1, nn}];
    Array[a, nn] (* Michael De Vlieger, Jun 11 2024 *)

A375563 a(1) = 1; for n > 1, a(n) is the smallest unused positive number that shares a factor with a(n-1) if a(n-1) is prime, otherwise a(n) is coprime to a(n-1).

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 10, 7, 14, 9, 8, 11, 22, 13, 26, 15, 16, 17, 34, 19, 38, 21, 20, 23, 46, 25, 12, 29, 58, 27, 28, 31, 62, 33, 32, 35, 18, 37, 74, 39, 40, 41, 82, 43, 86, 45, 44, 47, 94, 49, 24, 53, 106, 51, 50, 57, 52, 55, 36, 59, 118, 61, 122, 63, 64, 65, 42, 67, 134, 69, 56, 71, 142, 73, 146
Offset: 1

Views

Author

Scott R. Shannon, Aug 19 2024

Keywords

Comments

The terms are all concentrated along three lines with the central line, consisting entirely of all the odd terms, along the line a(n) = n. Surprisingly however there are no fixed points in the first 100000 terms. In the same range the primes appear in their natural order. The sequence is conjectured to be a permutation of the positive integers.

Examples

			a(6) = 5 as a(5) = 6 is a composite number, and 5 is the smallest unused number that is coprime to 6.
		

Crossrefs

A373623 a(n) = n for n <= 3; for n > 3, a(n) is the smallest unused positive number that shares a factor with the most recently appearing even number if a(n-1) is odd, otherwise it shares a factor with the most recently appearing odd number if a(n-1) is even.

Original entry on oeis.org

1, 2, 3, 4, 6, 9, 8, 12, 15, 10, 5, 14, 20, 25, 16, 30, 35, 18, 7, 21, 22, 24, 27, 26, 33, 13, 28, 39, 32, 36, 42, 45, 34, 40, 48, 50, 51, 38, 17, 19, 44, 57, 11, 46, 55, 23, 52, 69, 54, 60, 63, 56, 49, 58, 70, 77, 62, 66, 84, 88, 91, 64, 65, 68, 75, 72, 78, 80, 81, 74, 87, 37, 76, 111, 82, 90, 93
Offset: 1

Views

Author

Scott R. Shannon, Jun 11 2024

Keywords

Comments

The terms studied are all concentrated along lines of different gradient; the prime numbers are all distributed on the lines with gradient < 1 while all other numbers are on the lines with gradient > 1, the highest concentration of terms appearing on a line with gradient ~ 1.04. The uppermost of these lines appear to consist entirely of numbers with two or three distinct prime factors. See the attached images. It is conjectured that this behavior is true for all n.
The primes do not appear in their natural order, with 13 appearing before 11 being the first example. The fixes points being 1, 2, 3, 4, 10, 18, 38; it is likely no more exist.
In the first 200000 terms the longest run of consecutive even terms is eight, beginning at a(7681) = 8078, while the longest run of consecutive odd terms is seven, beginning at a(101234) = 105471. It in unknown if these runs can be of arbitrary length. The sequence is conjectured to be a permutation of the positive numbers.

Examples

			a(5) = 6 as a(4) = 4 is even and the most recently appearing odd term is a(3) = 3, and 6 is the smallest unused positive number that shares a factor with 3.
a(7) = 8 as a(6) = 9 is odd and the most recently appearing even term is a(5) = 6, and 8 is the smallest unused positive number that shares a factor with 6.
		

Crossrefs

Programs

  • Mathematica
    c[] := False; j = 3; nn = 120; q[] := 0; m[_] := 1;
    Array[Set[{a[#], c[#]}, {#, True}] &, j]; q[0] = 2; q[1] = 3; u = 5;
    Do[If[OddQ[j],
       If[PrimePowerQ[q[0]], k = m[2];
         While[c[2 k], k++]; k *= 2; While[c[2 m[2]], m[2]++],
         k = u; While[Or[c[k], CoprimeQ[q[0], k]], k++]],
       If[PrimePowerQ[q[1]],
         (k = m[#]; While[c[k #], k++]; k *= #;
           While[c[#  m[#]], m[#]++]) &[FactorInteger[q[1]][[1, 1]]],
         k = u; While[Or[c[k], CoprimeQ[q[1], k]], k++]] ]; q[Mod[j, 2]] = j;
      Set[{a[n], c[k], j}, {k, True, k}];
      If[k == u, While[c[u], u++]], {n, j + 1, nn}];
    Array[a, nn] (* Michael De Vlieger, Jun 20 2024 *)

A373698 a(n) = n for n <= 3; for n > 3, a(n) is the smallest unused positive number that shares a factor with the largest odd divisor of a(n-1).

Original entry on oeis.org

1, 2, 3, 6, 9, 12, 15, 5, 10, 20, 25, 30, 18, 21, 7, 14, 28, 35, 40, 45, 24, 27, 33, 11, 22, 44, 55, 50, 60, 36, 39, 13, 26, 52, 65, 70, 42, 48, 51, 17, 34, 68, 85, 75, 54, 57, 19, 38, 76, 95, 80, 90, 63, 49, 56, 77, 66, 69, 23, 46, 92, 115, 100, 105, 72, 78, 81, 84, 87, 29, 58, 116, 145, 110
Offset: 1

Views

Author

Scott R. Shannon, Jun 13 2024

Keywords

Comments

The terms studied are all concentrated along lines of different gradient, the prime numbers, which appear in their natural order, forming the lowermost line. The central line has the highest concentration of terms and is composed of numbers with various numbers of prime factors, while many of the other lines consist of terms with the same number of prime factors. The odd terms all fall into the highest, lowest, and middle line, all other lines containing only even terms. It is conjectured the above behaviors are true for all n. See the attached images.
It appears that when a prime p > 3 is a term, it is immediately preceded by a term 3*p and followed by a term 2*p. This is true for at least the first 500000 terms. This pattern is similar to that seen in the EKG sequence A064413 but here the order of appearance of 2*p and 3*p is reversed.
Other than the first three terms the first fixed points are 42544 and 47312, and no more exist in the first 500000 terms. An examination of the graphs shows these points are due to one of the lines of concentration crossing the line a(n) = n, implying it, and probably most of the other lines, has a slight downward curvature.
In the first 100000 terms the longest run of consecutive odd and even terms is eight, starting n = 96230 and n = 30466 respectively. It in unknown if these runs can be of arbitrary length. No power of 2, other than 2 itself, can be a term.

Examples

			a(11) = 25 as a(10) = 20 which has a largest odd divisor of 5, and 25 is the smallest unused positive number that shares a factor with 5.
		

Crossrefs

Programs

  • Mathematica
    j = 3; nn = 120; c[] := False; m[] := 1;
    Array[Set[{a[#], c[#]}, {#, True}] &, j]; u = j + 1;
    Do[If[PrimePowerQ[j],
        (k = m[#]; While[c[k #], k++]; k *= #; While[c[#  m[#]], m[#]++]) &@
          FactorInteger[j][[1, 1]],
         k = u; While[Or[c[k], CoprimeQ[j, k]], k++] ];
      Set[{a[n], c[k], j}, {#, True, #/2^IntegerExponent[#, 2]}] &[k],
      {n, j + 1, nn}];
    Array[a, nn] (* Michael De Vlieger, Jun 20 2024 *)

A373860 a(n) = n for n <= 4; for n > 4, a(n) is the smallest unused positive number that shares a factor with the most recently appearing even number prior to a(n-1) if a(n-1) is even, otherwise it shares a factor with the most recently appearing odd number prior to a(n-1) if a(n-1) is odd.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 9, 12, 10, 14, 5, 15, 20, 7, 18, 16, 21, 28, 22, 24, 11, 27, 33, 30, 26, 25, 36, 13, 35, 39, 40, 32, 34, 38, 17, 42, 19, 51, 57, 45, 48, 44, 46, 50, 23, 54, 52, 56, 58, 49, 69, 63, 60, 29, 66, 55, 87, 65, 72, 62, 64, 31, 70, 68, 74, 76, 37, 93, 111, 75, 78, 80, 81, 84, 82, 77, 90
Offset: 1

Views

Author

Scott R. Shannon, Jun 19 2024

Keywords

Comments

The terms appear to follow a pattern similar to the EKG sequence A064413, i.e., the terms are concentrated along just three lines of different gradients, and the lower line consists only of primes. The uppermost line appears to be composed only of semiprimes that are divisible by 3, while the middle line contains all other terms. See the attached images. For the first 100000 terms the primes appear in their natural order, implying that is likely true for all n.
The fixed points are 1, 2, 3, 4, 16, 32, 124, and it is likely that no more exist. The sequence is conjectured to be a permutation of the positive numbers.

Examples

			a(8) = 12 as a(7) = 9 is odd, and the most recently appearing odd number prior to a(7) is a(3) = 3, and 12 is the smallest unused positive number to share a factor with 3.
		

Crossrefs

Programs

  • Mathematica
    c[] := False; j = 4; nn = 120; q[] := 0; m[_] := 1;
    Array[Set[{a[#], c[#]}, {#, True}] &, j]; q[0] = 4; q[1] = 3; u = 5;
    Do[If[EvenQ[j],
      If[PrimePowerQ[q[0]], k = m[2];
       While[c[2 k], k++]; k *= 2; While[c[2 m[2]], m[2]++],
       k = u; While[Or[c[k], CoprimeQ[q[0], k]], k++]],
      If[PrimePowerQ[q[1]],
       (k = m[#]; While[c[k #], k++]; k *= #;
          While[c[#  m[#]], m[#]++]) &[FactorInteger[q[1]][[1, 1]]],
       k = u; While[Or[c[k], CoprimeQ[q[1], k]], k++]]
      ]; q[Mod[j, 2]] = j;
     Set[{a[n], c[k], j}, {k, True, k}];
     If[k == u, While[c[u], u++]], {n, j + 1, nn}];
    Array[a, nn] (* Michael De Vlieger, Jun 20 2024 *)
  • Python
    from math import gcd, lcm
    from itertools import count, islice
    def agen(): # generator of terms
        yield from [1, 2, 3, 4]
        aset, an, eo, mink = {1, 2, 3, 4}, 4, [2, 3], 5
        while True:
            s, prevan = eo[an%2], an
            an = next(k for k in count(mink) if k not in aset and gcd(s,k)>1)
            eo[prevan%2] = prevan
            aset.add(an)
            while mink in aset: mink += 1
            yield an
    print(list(islice(agen(), 77))) # Michael S. Branicky, Jun 20 2024

A384045 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that shares a factor with a(n-1) if it is greater than it, else it is coprime to a(n-1) if it is less than it.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 10, 7, 14, 9, 8, 12, 11, 22, 13, 26, 15, 18, 17, 16, 20, 19, 38, 21, 24, 23, 46, 25, 30, 29, 27, 33, 28, 32, 31, 62, 35, 34, 36, 39, 37, 74, 41, 40, 42, 44, 43, 86, 45, 48, 47, 94, 49, 56, 51, 50, 52, 54, 53, 106, 55, 60, 59, 57, 63, 58, 64, 61
Offset: 1

Views

Author

Scott R. Shannon, May 18 2025

Keywords

Comments

For the terms studied all primes appear in their natural order, and approximately 65% of all primes p are immediately followed by a term 2*p. These later terms form the upper of the two lines in the graph.
In the first 100000 terms the fixed points are 1, 2, 12, 18, 98, 182, 306, 380; it is likely no more exist.
The sequence is a permutation of the positive integers as the lowest unused number after k terms will always appear as it will eventually be coprime to a(j) for some j > k.

Examples

			a(3) = 4 as a(2) = 2 and 4 > 2 and shares a factor with it. Note 3 cannot be chosen as 3 > 2 but is coprime to 2.
a(4) = 3 as a(3) = 4 and 3 < 4 and is coprime to it.
		

Crossrefs

Programs

  • Mathematica
    nn = 120; c[_] := False; j = 2; u = 3; c[1] = c[2] = True;
    {1, 2}~Join~Reap[Do[k = u;
      While[And[k < j, Or[c[k], ! CoprimeQ[j, k]]], k++];
        If[k >= j,
          If[PrimePowerQ[j],
            Set[{p, k}, {FactorInteger[j][[1, 1]], 1}]; While[c[k*p], k++]; k *= p,
            While[Or[c[k], CoprimeQ[j, k]], k++] ] ];
        Sow[k]; Set[{c[k], j}, {True, k}];
        If[k == u, While[c[u], u++]],
    {n, 3, nn}] ][[-1, 1]] (* Michael De Vlieger, May 27 2025 *)
Showing 1-8 of 8 results.