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

A386482 a(1)=1, a(2)=2; thereafter a(n) is either the greatest number k < a(n-1) not already used such that gcd(k, a(n-1)) > 1, or if no such k exists then a(n) is the smallest number k > a(n-1) not already used such that gcd(k, a(n-1)) > 1.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 15 2025, based on email messages from Geoffrey Caveney

Keywords

Comments

Similar to the EKG sequence A064413, but whereas in that sequence a(n) is chosen to be as small as possible, here the primary goal is to choose a(n) to be less than a(n-1) and as close to it as possible. This sequence first differs from the EKG sequence at n = 8, where a(8) = k = 10 is closer to a(7) = 12 than A064413(8) = 8 is.
A significant difference from the EKG sequence is that the primes do not appear in their natural order. Also, it is not always true that a prime p is preceded by 2*p when it first appears. 4k+3 primes appear to be preceded by smaller multiples than 4k+1 primes.
It is conjectured that every positive number appears.
It is interesting to study what happens if the first two terms are taken to be 1,s, with s >= 2, or if the first s terms are taken to be 1,2,3,...,s, with s >= 2. Call two such sequences equivalent if they eventually merge. The 1,3 and 1,2,3 sequences merge with each other after half-a-dozen terms. But at present we do not know if they merge with the 1,2 sequence.
It appears that many sequences that start 1,s and 1,2,3,...,s with small s merge with one of the sequences 1,2 or 1,2,3 or 1,2,3,...,11.
[The preceding comments are from Geoffrey Caveney's emails.]
From Michael De Vlieger, Aug 15 2025: (Start)
There are long runs of terms with the same parity in this sequence. For example, beginning at a(481) = 948, there are 100 consecutive even terms. Starting with a(730076) = 1026330, there are 100869 consecutive even terms, followed by 36709 consecutive odd terms. Runs of even terms tend to be longer than those of odd.
There are long runs of first differences of -2 and -6 in this sequence, and that there appear to be three phases. The predominant (A) phase has a(n) = a(n-1)-2, the second (B) phase has a(n) = a(n-1)-6, and then there is a turbulent (C) phase [C] with varied differences.
Generally the even runs correspond to differences a(n)-a(n-1) = 2 and feature square-free terms separated by an odd number of terms in A126706. Phase [C] tends to be largely odd squarefree semiprimes and includes prime powers. (End)

References

  • Geoffrey Caveney, Emails to N. J. A. Sloane, Aug 13 2025 - Aug 15 2025.

Crossrefs

Cf. A064413 (EKG), A387072 (inverse), A387073 (record high points), A387074 (indices of record high points), A387075 (first differences), A387076 (primes in order of appearance), A387077 (indices of primes), A387078 (run lengths of consecutive odd and even terms), A387080 (variant that begins with 1,3).

Programs

  • Mathematica
    aList[n_] := Module[{an = 2, aset = <|2 -> True|>, m}, Reap[Sow[1]; Sow[an];
    Do[m = SelectFirst[Range[an - 1, 2, -1], ! KeyExistsQ[aset, #] && GCD[#, an] > 1 & ];
    If[MissingQ[m], m = NestWhile[# + 1 &, an + 1, !(! KeyExistsQ[aset, #] && GCD[#, an] > 1) & ]];
    aset[m] = True; an = m; Sow[an], {n - 2}]][[2, 1]]]; aList[83]  (* Peter Luschny, Aug 15 2025 *)
  • PARI
    \\ See Links section.
    
  • Python
    from math import gcd
    from itertools import count, islice
    def A386482_gen(): # generator of terms
        yield 1
        an, aset = 2, {2}
        while True:
            yield an
            m = next((k for k in range(an-1, 1, -1) if k not in aset and gcd(k, an) > 1), False)
            if not m: m = next(k for k in count(an+1) if k not in aset and gcd(k, an) > 1)
            an = m
            aset.add(an)
    print(list(islice(A386482_gen(), 83))) # Michael S. Branicky, Aug 15 2025

A387076 Primes in the order in which they appear in A386482.

Original entry on oeis.org

2, 3, 7, 5, 11, 19, 13, 17, 31, 23, 47, 37, 29, 59, 61, 79, 131, 83, 107, 103, 127, 137, 317, 53, 67, 71, 73, 211, 41, 43, 97, 263, 139, 89, 347, 379, 149, 457, 173, 179, 947, 101, 109, 191, 647, 181, 269, 271, 431, 433, 439, 113, 557, 193, 569, 449, 197, 151
Offset: 1

Views

Author

Michael De Vlieger, Aug 15 2025

Keywords

Crossrefs

Programs

  • Mathematica
    Block[{c, j, k, m, p, r, nn},
      nn = 3000; c[] := False; m[] := 1; j = 2; c[1] = c[2] = True; r = 1;
      {1}~Join~Monitor[Most@ Reap[Do[
        If[PrimePowerQ[j],
          Set[{p, k, m}, {#1, #1^(#2 - 1), #1^(#2 - 1)}] & @@
            FactorInteger[j][[1]]; While[And[c[k*p], k != 0], k--];
            If[k == 0, k = m; While[c[k*p], k++]]; k *= p,
          k = j - 1; While[And[Or[c[k], CoprimeQ[j, k]], k != 1], k--];
            If[k == 1, k += j; While[Or[c[k], CoprimeQ[j, k] ], k++] ] ];
        If[PrimeQ[k], Sow[k]];
        Set[{c[k], j}, {True, k}], {n, 3, nn}] ][[-1, 1]], n] ]

A386483 Index of n-th prime in A386482, or -1 if that prime is missing.

Original entry on oeis.org

2, 5, 17, 11, 24, 44, 52, 31, 73, 126, 57, 115, 809, 821, 76, 652, 144, 189, 667, 674, 678, 207, 287, 1016, 832, 2020, 320, 310, 2026, 2637, 368, 236, 453, 996, 1206, 3017, 3541, 3544, 4876, 1425, 1497, 2425, 2053, 2747, 3006, 4867, 684, 12680, 12803, 12808, 12898, 12901, 6247, 12907, 13279, 837, 2442, 2445, 9513, 9795, 13080, 13088
Offset: 1

Views

Author

N. J. A. Sloane, Aug 16 2025

Keywords

Crossrefs

Programs

  • PARI
    \\ See Links section.

A387081 Indices k such that lpf(s(k)) != lpf(s(k-1)), where s = A386482 and lpf = A020736.

Original entry on oeis.org

2, 5, 11, 16, 17, 24, 31, 41, 44, 49, 52, 57, 70, 73, 76, 100, 103, 106, 115, 121, 125, 126, 139, 144, 176, 189, 194, 205, 207, 236, 275, 287, 299, 310, 320, 363, 368, 431, 453, 479, 615, 634, 647, 650, 652, 661, 662, 667, 674, 678, 684, 737, 785, 788, 800, 801
Offset: 1

Views

Author

Michael De Vlieger, Aug 19 2025

Keywords

Comments

A387077 appears to be a proper subset. This is to say the indices of primes in A386482 appear in this sequence.

Examples

			Table of n, a(n), relating these to s = A387482:
 n a(n)=k  s(k-1) s(k) s(k+1)
-----------------------------
 1     2     1     2     4
 2     5     6     3     9
 3    11    14     7    21
 4    16    20    15     5
 5    17    15     5    25
 6    24    22    11    33
 7    31    38    19    57
 8    41    40    35    45
 9    44    39    13    65
10    49    56    49    63
11    52    51    17    68
12    57    62    31    93
23   139   152   171   165
		

Crossrefs

Programs

  • Mathematica
    s = Import["https://oeis.org/A386482/b386482.txt","Data"][[ ;; , -1]]; j = 1; {2}~Join~Reap[Do[If[! Divisible[Abs[j - s[[n]]], FactorInteger[j][[1, 1]] ], Sow[n]]; j = s[[n]], {n, 2, Length[s]}] ][[-1, 1]]
Showing 1-4 of 4 results.