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-10 of 17 results. Next

A255479 Inverse permutation to A255582.

Original entry on oeis.org

1, 2, 3, 4, 10, 5, 13, 6, 7, 8, 21, 9, 24, 11, 12, 16, 31, 14, 38, 18, 15, 23, 43, 20, 30, 22, 17, 25, 51, 28, 59, 27, 19, 29, 32, 37, 67, 36, 26, 34, 78, 35, 81, 39, 42, 41, 90, 44, 52, 46, 33, 48, 101, 47, 58, 50, 40, 49, 108, 55, 119, 57, 54, 64, 60, 63, 131, 66, 45, 62, 136, 68
Offset: 1

Views

Author

N. J. A. Sloane, Feb 27 2015

Keywords

Comments

The differences |a(n)-A064664(n)| seem surprisingly small (see A255482).
About the definition: the map n -> A255582(n) is an element of the group of all permutations of the positive integers; this is the inverse of that permutation.

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a255479 = (+ 1) . fromJust. (`elemIndex` a255582_list)
    -- Reinhard Zumkeller, Mar 10 2015

A256974 A254077(n)-A255582(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 17, 0, -34, 0, 9, -2, 32, 23, 8, -12, -8, 3, -4, -2, -12, -27, 0, 17, -8, 7, 26, 0, -27, -7, 5, -19, 8, -26, 31, 22, -62, -4, 27, 0, 1, 4, 48
Offset: 0

Views

Author

N. J. A. Sloane, Apr 22 2015

Keywords

Comments

Although the sequences have very similar definitions, A254077 is a mystery while A255582 is easily shown to be a permutation of the natural numbers.

Crossrefs

A255480 a(n) = gcd(b(n),b(n-2)), where b(n) = A255582(n).

Original entry on oeis.org

1, 2, 3, 4, 3, 2, 3, 5, 2, 5, 7, 3, 7, 2, 3, 4, 3, 4, 11, 2, 11, 13, 2, 13, 4, 3, 2, 5, 17, 5, 17, 5, 3, 2, 6, 19, 4, 19, 2, 3, 23, 3, 23, 2, 3, 2, 2, 4, 29, 7, 29, 7, 3, 7, 2, 11, 31, 5, 31, 5, 3, 2, 2, 4, 37, 4, 37, 3, 3, 5, 3, 4, 9, 2, 6, 41, 2, 41, 43, 3, 43, 8, 3, 4, 17
Offset: 3

Views

Author

N. J. A. Sloane, Feb 28 2015

Keywords

Crossrefs

Programs

  • Haskell
    a255480 n = a255480_list !! (n-1)
    a255480_list = zipWith gcd a255582_list $ drop 2 a255582_list
    -- Reinhard Zumkeller, Mar 10 2015

A255481 a(n) = gcd(b(n),b(n-1)), where b(n) = A255582(n).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 28 2015

Keywords

Comments

By definition, a(n) <= A255480(n) for n >= 4.

Crossrefs

Programs

  • Haskell
    a255481 n = a255481_list !! (n-1)
    a255481_list = zipWith gcd a255582_list $ tail a255582_list
    -- Reinhard Zumkeller, Mar 10 2015

A256424 A255582 smoothed by replacing each prime p with 2p and each thrice-prime 3p also with 2p.

Original entry on oeis.org

1, 4, 6, 4, 4, 8, 6, 10, 12, 10, 14, 10, 14, 18, 14, 16, 27, 20, 22, 24, 22, 26, 22, 26, 28, 26, 32, 30, 34, 25, 34, 35, 34, 40, 42, 38, 36, 38, 44, 38, 46, 45, 46, 48, 46, 50, 54, 52, 58, 56, 58, 49, 58, 63, 60, 77, 62, 55, 62, 65, 62, 70
Offset: 1

Views

Author

N. J. A. Sloane, Apr 08 2015

Keywords

Comments

The result is to change a three-pronged graph to a single line.

Crossrefs

Cf. A255582.

A256529 Partial sums of A255582.

Original entry on oeis.org

1, 3, 6, 10, 16, 24, 33, 43, 55, 60, 74, 89, 96, 114, 135, 151, 178, 198, 231, 255, 266, 292, 314, 327, 355, 394, 426, 456, 490, 515, 532, 567, 618, 658, 700, 738, 774, 793, 837, 894, 940, 985, 1008, 1056, 1125, 1175, 1229, 1281, 1339, 1395, 1424, 1473, 1560, 1623, 1683, 1760, 1822, 1877, 1908, 1973, 2066, 2136, 2202, 2266
Offset: 1

Views

Author

Omar E. Pol, May 08 2015

Keywords

Comments

First differs from A256528 at a(29).

Crossrefs

A256214 Indices of prime terms in A255582.

Original entry on oeis.org

2, 3, 10, 13, 21, 24, 31, 38, 43, 51, 59, 67, 78, 81, 90, 101, 108, 119, 131, 136, 141, 152, 159, 171, 183, 188, 195, 207, 214, 219, 237, 256, 263, 264, 278, 292, 299, 306, 316, 328, 339, 347, 368, 371, 379, 380, 405, 421, 431, 440, 447, 457
Offset: 1

Views

Author

N. J. A. Sloane, Mar 26 2015

Keywords

Comments

It would be nice to have a definition for this sequence which is independent of A255582.

Crossrefs

A064413 EKG sequence (or ECG sequence): a(1) = 1; a(2) = 2; for n > 2, a(n) = smallest number not already used which shares a factor with a(n-1).

Original entry on oeis.org

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

Views

Author

Jonathan Ayres (Jonathan.ayres(AT)btinternet.com), Sep 30 2001

Keywords

Comments

Locally, the graph looks like an EKG (American English) or ECG (British English).
Calculating the square of A064413 and plotting the results shows the EKG behavior even more dramatically - see A104125. - Parthasarathy Nambi, Jan 27 2005
Theorem: (1) Every number appears exactly once: this is a permutation of the positive numbers. - J. C. Lagarias, E. M. Rains, N. J. A. Sloane, Oct 03 2001
The permutation has cycles (1) (2) (3, 4, 6, 9, 10, 5) (..., 20, 18, 12, 7, 14, 13, 28, 26, ...) (8) ...
Theorem: (2) The primes appear in increasing order. - J. C. Lagarias, E. M. Rains, N. J. A. Sloane, Oct 03 2001
Theorem: (3) When an odd prime p appears it is immediately preceded by 2p and followed by 3p. - Conjectured by Lagarias-Rains-Sloane, proved by Hofman-Pilipczuk.
Theorem: (4) Let a'(n) be the same sequence but with all terms p and 3p (p prime) changed to 2p (see A256417). Then lim a'(n)/n = 1, i.e., a(n) ~ n except for the values p and 3p for p prime. - Conjectured by Lagarias-Rains-Sloane, proved by Hofman-Pilipczuk.
Conjecture: If a(n) != p, then almost everywhere a(n) > n. - Thomas Ordowski, Jan 23 2009
Conjecture: lim #(a_n > n) / n = 1, i.e., #(a_n > n) ~ n. - Thomas Ordowski, Jan 23 2009
Conjecture: A term p^2, p a prime, is immediately preceded by p*(p+1) and followed by p*(p+2). - Vladimir Baltic, Oct 03 2001. This is false, for example the sequence contains the 3 terms p*(p+2), p^2, p*(p+3) for p = 157. - Eric Rains
Theorem: If a(k) = 3p, then |{a(m) : a(m>k) < 3p}| = 3p - k. Proof: If a(k) = 3p, then all a(mk) > p and |{a(m) : a(m>k) < 3p}| = 3p - k. - Thomas Ordowski, Jan 22 2009
Let ...,a_i,...,2p,p,3p,...,a_j,... There does not exist a_i > 3p. There does not exist a_j < p. - Thomas Ordowski, Jan 20 2009
Let...,a,...,2p,p,3p,...,b,... All a<3p and b>p. #(a>2p) <= #(b<2p). - Thomas Ordowski, Jan 21 2009
If a(k)=3p then |{a(m):a(m>k)<3p}|=3p-k. - Thomas Ordowski, Jan 22 2009
GCD(a(n),n) = A247379(n). - Reinhard Zumkeller, Sep 16 2014
If the definition is changed to require that the GCD of successive terms be a prime power > 1, the sequence stays the same until a(578)=620, at which point a(579)=610 has GCD = 10 with the previous term. - N. J. A. Sloane, Mar 30 2015
From Michael De Vlieger, Dec 06 2021: (Start)
For prime p > 2, we have the chain {j : 2|j} -> 2p -> p -> 3p -> {k : 3|k}. The term j introducing 2p must be even, since 2p is an even squarefree semiprime proved by Hofman-Pilipczuk to introduce p itself. Hence no term a(i) such that p | a(i) exists in the sequence for i < n-1, where a(n) = p, leaving 2|j. Similarly, the term k following 3p must be divisible by 3 since the terms mp that are not coprime to p (thus implying p | mp) have m >= 4, thereby large compared to numbers k such that 3|k that belong to the cototient of 3p. For the chain {4, 6, 3, 9, 12}, the term 12 following 3p indeed is 4p, but p = 3; this is the only case of 4p following 3p in the sequence. As a consequence, for i > 1, A073734(A064955(i)-1) = 2 and A073734(A064955(i)+2) = 3.
For Fermat primes p, we have the chain {j : 2|j} -> 2^e-> {2p = 2^e + 2} -> {p = 2^(e-1) + 1} -> 3p -> {k : 3|k}.
a(3) = 4 = 2^2, a(5) = 3 = 2^1 + 1;
a(8) = 8 = 2^3, a(10) = 5 = 2^2 + 1;
a(31) = 32 = 2^5, a(33) = 17 = 2^4 + 1;
a(485) = 512 = 2^9, a(487) = 257 = 2^8 + 1;
a(127354) = 131072 = 2^17, a(127356) = 65537 = 2^16 + 1.
(End)

Examples

			a(2) = 2, a(3) = 4 (gcd(2,4) = 2), a(4) = 6 (gcd(4,6) = 2), a(5) = 3 (gcd(6,3) = 3), a(6) = 9 (6 already used so next number which shares a factor is 9 since gcd(3,9) = 3).
		

References

  • N. J. A. Sloane, Seven Staggering Sequences, in Homage to a Pied Puzzler, E. Pegg Jr., A. H. Schoen and T. Rodgers (editors), A. K. Peters, Wellesley, MA, 2009, pp. 93-110.

Crossrefs

A073734 gives GCD's of successive terms.
See A064664 for the inverse permutation. See A064665-A064668 for the first two infinite cycles of this permutation. A064669 gives cycle representatives.
See A064421 for sequence giving term at which n appears.
See A064424, A074177 for records.
Cf. A064955 & A352194 (prime positions), A195376 (parity), A064957 (positions of odd terms), A064953 (positions of even terms), A064426 (first differences).
See A169857 and A119415 for the effect of changing the start.
Cf. A240024 (nonprime version).
Cf. A152458 (fixed points), A247379, A247383.
For other initial terms, see A169841, A169837, A169843, A169855, A169849.
A256417 is a smoothed version.
See also A255582, A256466, A257218, A257311-A257315, A257405, A253279 (two-dimensional analog).
See also A276127.

Programs

  • Haskell
    import Data.List (delete, genericIndex)
    a064413 n = genericIndex a064413_list (n - 1)
    a064413_list = 1 : f 2 [2..] where
       ekg x zs = f zs where
           f (y:ys) = if gcd x y > 1 then y : ekg y (delete y zs) else f ys
    -- Reinhard Zumkeller, May 01 2014, Sep 17 2011
    
  • Maple
    h := array(1..20000); a := array(1..10000); maxa := 300; maxn := 2*maxa; for n from 1 to maxn do h[n] := -1; od: a[1] := 2; h[2] := 1; c := 2; for n from 2 to maxa do for m from 2 to maxn do t1 := gcd(m,c); if t1 > 1 and h[m] = -1 then c := m; a[n] := c; h[c] := n; break; fi; od: od: ap := []: for n from 1 to maxa do ap := [op(ap),a[n]]; od: hp := []: for n from 2 to maxa do hp := [op(hp),h[n]]; od: convert(ap,list); convert(hp,list); # this is very crude!
    N:= 1000: # to get terms before the first term > N
    V:= Vector(N):
    A[1]:= 1:
    A[2]:= 2: V[2]:= 1:
    for n from 3 do
      S:= {seq(seq(k*p,k=1..N/p),p=numtheory:-factorset(A[n-1]))};
      for s in sort(convert(S,list)) do
        if V[s] = 0 then
          A[n]:= s;
          break
        fi
      od;
      if V[s] = 1 then break fi;
      V[s]:= 1;
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Jan 18 2016
  • Mathematica
    maxN = 100; ekg = {1, 2}; unused = Range[3, maxN]; found = True; While[found, found = False; i = 0; While[ !found && i < Length[unused], i++; If[GCD[ekg[[-1]], unused[[i]]] > 1, found = True; AppendTo[ekg, unused[[i]]]; unused = Delete[unused, i]]]]; ekg (* Ayres *)
    ekGrapher[s_List] := Block[{m = s[[-1]], k = 3}, While[MemberQ[s, k] || GCD[m, k] == 1, k++ ]; Append[s, k]]; Nest[ekGrapher, {1, 2}, 71] (* Robert G. Wilson v, May 20 2009 *)
  • PARI
    a1=1; a2=2; v=[1,2];
    for(n=3,100,a3=if(n<0,0,t=1;while(vecmin(vector(length(v),i,abs(v[i]-t)))*(gcd(a2,t)-1)==0,t++);t);a2=a3;v=concat(v,a3););
    a(n)=v[n];
    /* Benoit Cloitre, Sep 23 2012 */
    
  • Python
    from math import gcd
    A064413_list, l, s, b = [1,2], 2, 3, {}
    for _ in range(10**5):
        i = s
        while True:
            if not i in b and gcd(i, l) > 1:
                A064413_list.append(i)
                l, b[i] = i, True
                while s in b:
                    b.pop(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 08 2014

Formula

a(n) = smallest number not already used such that gcd(a(n), a(n-1)) > 1.
In Lagarias-Rains-Sloane (2002), it is conjectured that almost all a(n) satisfy the asymptotic formula a(n) = n (1+ 1/(3 log n)) + o(n/log n) as n -> oo and that the exceptional terms when the sequence is a prime or 3 times a prime p produce the spikes in the sequence. See the paper for a more precise statement of the conjecture. - N. J. A. Sloane, Mar 07 2015

Extensions

More terms from Naohiro Nomoto, Sep 30 2001
Entry extensively revised by N. J. A. Sloane, Oct 10 2001

A098550 The Yellowstone permutation: a(n) = n if n <= 3, otherwise the smallest number not occurring earlier having at least one common factor with a(n-2), but none with a(n-1).

Original entry on oeis.org

1, 2, 3, 4, 9, 8, 15, 14, 5, 6, 25, 12, 35, 16, 7, 10, 21, 20, 27, 22, 39, 11, 13, 33, 26, 45, 28, 51, 32, 17, 18, 85, 24, 55, 34, 65, 36, 91, 30, 49, 38, 63, 19, 42, 95, 44, 57, 40, 69, 50, 23, 48, 115, 52, 75, 46, 81, 56, 87, 62, 29, 31, 58, 93, 64, 99, 68, 77, 54, 119, 60
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 14 2004

Keywords

Comments

For n > 3, gcd(a(n), a(n-1)) = 1 and gcd(a(n), a(n-2)) > 1. (This is just a restatement of the definition.)
This is now known to be a permutation of the natural numbers: see the 2015 article by Applegate, Havermann, Selcoe, Shevelev, Sloane, and Zumkeller.
From N. J. A. Sloane, Nov 28 2014: (Start)
Some of the known properties (but see the above-mentioned article for a fuller treatment):
1. The sequence is infinite. Proof: We can always take a(n) = a(n-2)*p, where p is a prime that is larger than any prime dividing a(1), ..., a(n-1). QED
2. At least one-third of the terms are composite. Proof: The sequence cannot contain three consecutive primes. So at least one term in three is composite. QED
3. For any prime p, there is a term that is divisible by p. Proof: Suppose not. (i) No prime q > p can divide any term. For if a(n)=kq is the first multiple of q to appear, then we could have used kp < kq instead, a contradiction. So every term a(n) is a product of primes < p. (ii) Choose N such that a(n) > p^2 for all n > N. For n > N, let a(n)=bg, a(n+1)=c, a(n+2)=dg, where g=gcd(a(n),a(n+2)). Let q be the largest prime factor of g. We know q < p, so qp < p^2 < dg, so we could have used qp instead of dg, a contradiction. QED
3a. Let a(n_p) be the first term that is divisible by p (this is A251541). Then a(n_p) = q*p where q is a prime less than p. If p < r are primes then n_p < n_r. Proof: Immediate consequences of the definition.
4. (From David Applegate, Nov 27 2014) There are infinitely many even terms. Proof:
Suppose not. Then let 2x be the maximum even entry. Because the sequence is infinite, there exists an N such that for any n > N, a(n) is odd, and a(n) > x^2.
In addition, there must be some n > N such that a(n) < a(n+2). For that n, let g = gcd(a(n),a(n+2)), a(n) = bg, a(n+1)=c, a(n+2)=dg, with all of b,c,d,g relatively prime, and odd.
Since dg > bg, d > b >= 1, so d >= 3. Also, g >= 3.
Since a(n) = bg > x^2, one of b or g is > x.
Case 1: b > x. Then 2b > 2x, so 2b has not yet occurred in the sequence. And gcd(bg,2b)=b > x > 1, gcd(2b,c)=1, and since g >= 3, 2b < bg < dg. So a(n+2) should have been 2b instead of dg.
Case 2: g > x. Then 2g > 2x, so 2g has not yet occurred in the sequence. And gcd(bg,2g)=g > 1, gcd(2g,c)=1, and since d >= 3, 2g < dg. So a(n+2) should have been 2g instead of dg.
In either case, we derive a contradiction. QED
Conjectures:
5. For any prime p > 97, the first time we see p, it is in the subsequence a(n) = 2b, a(n+2) = 2p, a(n+4) = p for some n, b, where n is about 2.14*p and gcd(b,p)=1.
6. The value of |{k=1,..,n: a(k)<=k}|/n tends to 1/2. - Jon Perry, Nov 22 2014 [Comment edited by N. J. A. Sloane, Nov 23 2014 and Dec 26 2014]
7. Based on the first 250000 terms, I conjectured on Nov 30 2014 that a(n)/n <= (Pi/2)*log n.
8. The primes in the sequence appear in their natural order. This conjecture is very plausible but as yet there is no proof. - N. J. A. Sloane, Jan 29 2015
(End)
The only fixed points seem to be {1, 2, 3, 4, 12, 50, 86} - see A251411. Checked up to n=10^4. - L. Edson Jeffery, Nov 30 2014. No further terms up to 10^5 - M. F. Hasler, Dec 01 2014; up to 250000 - Reinhard Zumkeller; up to 300000 (see graph) - Hans Havermann, Dec 01 2014; up to 10^6 - Chai Wah Wu, Dec 06 2014; up to 10^8 - David Applegate, Dec 08 2014.
From N. J. A. Sloane, Dec 04 2014: (Start)
The first 250000 points lie on about 8 roughly straight lines, whose slopes are approximately 0.467, 0.957, 1.15, 1.43, 2.40, 3.38, 5.25 and 6.20.
The first six lines seem well-established, but the two lines with highest slope at present are rather sparse. Presumably as the number of points increases, there will be more and more lines of ever-increasing slopes.
These lines can be seen in the Havermann link. See the "slopes" link for a list of the first 250000 terms sorted according to slope (the four columns in the table give n, a(n), the slope a(n)/n, and the number of divisors of a(n), respectively).
The primes (with two divisors) all lie on the lowest line, and the lines of slopes 1.43 and higher essentially consist of the products of two primes (with four divisors).
(End)
The eight roughly straight lines mentioned above are actually curves. A good fit for the "line" with slope ~= 1.15 is a(n)~=n(1+1.0/log(n/24.2)), and a good fit for the other "lines" is a(n)~= (c/2)*n(1-0.5/log(n/3.67)), for c = 1,2,3,5,7,11,13. The first of these curves consists of most of the odd terms in the sequence. The second family consists of the primes (c=1), even terms (c=2), and c*prime (c=3,5,7,11,13,...). This functional form for the fit is motivated by the observed pattern (after the first 204 terms) of alternating even and odd terms, except for the sequence pattern 2*p, odd, p, even, q*p when reaching a prime (with q a prime < p). - Jon E. Schoenfield and David Applegate, Dec 15 2014
For a generalization, see the sequence of monomials of primes in the comment in A247225. - Vladimir Shevelev, Jan 19 2015
From Vladimir Shevelev, Feb 24 2015: (Start)
Let P be prime. Denote by S_P*P the first multiple of P appearing in the sequence. Then
1) For P >= 5, S_P is prime.
Indeed, let
a(n-2)=v, a(n-1)=w, a(n)=S_P*P. (*)
Note that gcd(v,P)=1. Therefore, by the definition of the sequence, S_P*P should be the smallest number such that gcd(v,S_P) > 1.
So S_P is the smallest prime factor of v.
2) The first multiples of all primes appear in the natural order.
Suppose not. Then there is a pair of primes P < Q such that S_Q*Q appears earlier than S_P*P. Let
a(m-2)=v_1, a(m-1)=w_1, a(m)=S_Q*Q. (**)
Then, as in (*), S_Q is the smallest prime factor of v_1. But this does not depend on Q. So S_Q*P is a smaller candidate in (**), a contradiction.
3) S_P < P.
Indeed, from (*) it follows that the first multiple of S_P appears earlier than the first multiple of P. So, by 2), S_P < P.
(End)
For any given set S of primes, the subsequence consisting of numbers whose prime factors are exactly the primes in S appears in increasing order. For example, if S = {2,3}, 6 appears first, in due course followed by 12, 18, 24, 36, 48, 54, 72, etc. The smallest numbers in each subsequence (i.e., those that appear first) are the squarefree numbers A005117(n), n > 1. - Bob Selcoe, Mar 06 2015

Crossrefs

Cf. A098548, A098551, A249943 (first time all 1..n appear), A251553.
The inverse permutation is in A098551.
A098552(n) = a(a(n)).
A251102(n) = GCD(a(n+2),a(n)).
Cf. A251101 (smallest prime factor), A251103 (largest prime factor), A251138 (number of distinct prime factors), A251140 (total number of prime factors), A251045 (squarefree part), A251089 (squarefree kernel), A250127 and A251415 (records for a(n)/n), A251411 (fixed points), A248647 (records).
Cf. also A251412 (trajectory of 11), A251556 (finite cycles), A251413 and A251414 (variant involving odd numbers), A249357 ("Fibonacci" variant).
Smallest missing numbers: A251416, A251417, A251546-A251552, A247253. See also A251557, A241558, A251559.
Indices of some pertinent subsequences: A251237 (even numbers), A251238 (odd numbers), A251391 (squarefree), A251541 and A251239 (primes), A251240 (squares of primes), A251241 (prime powers), A251393 (powers of 2), A251392 (nonprimes), A253297 (primes p for which some multiple k*p > 2*p precedes p).
Three arrays concerning the occurrences of multiples of primes: A251637, A251715, A251716.
Two sequences related to the numbers which immediately follow a prime: A253048, A253049. Seven sequences related to the numbers that appear two steps after primes: A251542, A251543, A251544, A251545, A253052, A253053, A253054. See also A253055 and A253056.
Other starting values: A251554, A251555.
See also A064413 (EKG sequence), A255582, A121216 (similar sequences), A257112 (two-dimensional analog).
See also A253765 and A253766 (bisections), A250299 (parity), A253768 (partial sums).
See A336957 for a variation.

Programs

  • Haskell
    import Data.List (delete)
    a098550 n = a098550_list !! (n-1)
    a098550_list = 1 : 2 : 3 : f 2 3 [4..] where
       f u v ws = g ws where
         g (x:xs) = if gcd x u > 1 && gcd x v == 1
                       then x : f v x (delete x ws) else g xs
    -- Reinhard Zumkeller, Nov 21 2014
    
  • Maple
    N:= 10^4: # to get a(1) to a(n) where a(n+1) is the first term > N
    B:= Vector(N,datatype=integer[4]):
    for n from 1 to 3 do A[n]:= n: od:
    for n from 4 do
      for k from 4 to N do
        if B[k] = 0 and igcd(k,A[n-1]) = 1 and igcd(k,A[n-2]) > 1 then
           A[n]:= k;
           B[k]:= 1;
           break
        fi
      od:
      if k > N then break fi
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Nov 21 2014
  • Mathematica
    f[lst_List] := Block[{k = 4}, While[ GCD[ lst[[-2]], k] == 1 || GCD[ lst[[-1]], k] > 1 || MemberQ[lst, k], k++]; Append[lst, k]]; Nest[f, {1, 2, 3}, 68] (* Robert G. Wilson v, Nov 21 2014 *)
    NN = Range[4, 1000]; a098550 = {1, 2, 3}; g = {-1}; While[g[[1]] != 0, g = Flatten[{FirstPosition[NN, v_ /; GCD[a098550[[-1]], v] == 1 && GCD[a098550[[-2]], v] > 1, 0]}]; If[g[[1]] != 0, d = NN[[g]]; a098550 = Flatten[Append[a098550, d[[1]]]]; NN = Delete[NN, g[[1]]]]]; Table[a098550[[n]], {n, 71}] (* L. Edson Jeffery, Jan 01 2015 *)
  • PARI
    a(n, show=1, a=3, o=2, u=[])={n<3&&return(n); show&&print1("1, 2"); for(i=4,n, show&&print1(","a); u=setunion(u, Set(a)); while(#u>1 && u[2]==u[1]+1, u=vecextract(u,"^1")); for(k=u[1]+1, 9e9, gcd(k,o)>1||next; setsearch(u,k)&&next; gcd(k,a)==1||next; o=a; a=k; break)); a} \\ Replace "show" by "a+1==i" in the main loop to print only fixed points. - M. F. Hasler, Dec 01 2014
    
  • Python
    from math import gcd
    A098550_list, l1, l2, s, b = [1,2,3], 3, 2, 4, {}
    for _ in range(1,10**6):
        i = s
        while True:
            if not i in b and gcd(i,l1) == 1 and gcd(i,l2) > 1:
                A098550_list.append(i)
                l2, l1, b[i] = l1, i, 1
                while s in b:
                    b.pop(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 04 2014

A336957 The Enots Wolley sequence: the lexicographically earliest infinite sequence {a(n)} of distinct positive numbers such that, for n>2, a(n) has a common factor with a(n-1) but not with a(n-2).

Original entry on oeis.org

1, 2, 6, 15, 35, 14, 12, 33, 55, 10, 18, 21, 77, 22, 20, 45, 39, 26, 28, 63, 51, 34, 38, 57, 69, 46, 40, 65, 91, 42, 30, 85, 119, 56, 24, 75, 95, 76, 36, 87, 145, 50, 44, 99, 93, 62, 52, 117, 105, 70, 58, 261, 111, 74, 68, 153, 123, 82, 80, 115, 161, 84, 60, 155, 217, 98, 48, 129, 215, 100
Offset: 1

Views

Author

Keywords

Comments

Suggested by the Yellowstone permutation A098550 except that now the key conditions in the definition have been reversed.
Let Ker(k), the kernel of k, denote the set of primes dividing k. Thus Ker(36) = {2,3}, Ker(1) = {}. Then Product_{p in Ker(k)} p = A000265(k), which is denoted by ker(k).
Theorem 1: For n>2, a(n) is the smallest number m not yet in the sequence such that
(i) Ker(m) intersect Ker(a(n-1)) is nonempty,
(ii) Ker(m) intersect Ker(a(n-2)) is empty, and
(iii) The set Ker(m) \ Ker(a(n-1)) is nonempty.
(Without condition (iii), every prime dividing m might also divide a(n-1), which would make it impossible to find a(n+1).)
Idea of proof: m always exists and is unique; no smaller choice for a(n) is possible; and taking a(n)=m does not lead to a contradiction. So a(n) must be m.
Theorem 2: For n>2, Ker(a(n)) contains at least two primes. (Immediate from Theorem 1, since a(n) must contain a prime in a(n-1) and a prime not in a(n-1).)
It follows that no odd prime p or even-or-odd prime power q^k, k>1, appears in the sequence. Obviously this sequence is not a permutation of the positive integers.
Theorem 3. For any M there is an n_0 such that n > n_0 implies a(n) > M. (This is a standard property of any sequence of distinct positive terms - see the Yellowstone paper).
Theorem 4. For any prime p, some term is divisible by p.
Proof. Take p=17 for concreteness. If 17 does not divide any term, then 19 cannot either (because the first time 19 appears, we could have used 17 instead).
So all terms are products only of 2,3,5,7,11,13. Go out a long way, use Theorem 2, and consider two huge successive terms, A*B, C*D, where Ker(B) = Ker(C) and Ker(A) intersect Ker(D) is empty. Either C or D must contain a huge prime power q^k, 2 <= q <= 13. If it is in C, replace it by q and multiply D by 17. If it is in D, replace it by 17. Either way we get a smaller legal candidate for C*D that is a multiple of 17. QED
Theorem 5. There are infinitely many even terms.
Proof. Suppose the prime p appears for the first times as a factor of a(n). Then we have a(n-1) = x*q^i, a(n) = q*p, where q

= 1. If q=2 then a(n) is even. So we may suppose q is odd. If x is odd then a(n+1) = 2*p. If x is even then obviously a(n-1) is even. So one of a(n-1), a(n), or a(n+1) is even for every prime p. So there are infinitely many even terms. QED - N. J. A. Sloane, Aug 28 2020

Theorem 6: For any prime p, infinitely many terms are divisible by p. - N. J. A. Sloane, Sep 09 2020. (I thought I had a proof that for any odd prime p, there is a term equal to 2p, but there was a gap in the argument. - N. J. A. Sloane, Sep 23 2020)
Theorem 7: There are infinitely many odd terms. - N. J. A. Sloane, Sep 12 2020
Conjecture 1: Every number with at least two distinct prime factors is in the sequence. In other words, apart from 1 and 2, this sequence is the complement of A000961.
[It seems very likely that the arguments used to prove Theorem 1 of the Yellowstone Permutation paper can be modified to prove the conjecture.]
The conditions permit us to start with a(1)=1, a(2)=2, and that does not lead to a contradiction, so those are the first two terms.
After 1, 2, the next term cannot be 4 or 5, but a(3) = 6 works.
For a(4), we can rule out 3, 4, 5, 7, 8, 9 11, 13 (powers of primes), and 10, 12, and 14 have a common factor with a(2). So a(4) = 15.
The graph of the first 100000 terms (see link) is similar to that of the Yellowstone permutation, but here the points lie on more lines.
The sequence has fixed points at n = 1, 2, 10, 90, 106, 150, 162, 246, 394, 398, 406, 410, ... (see A338050). - Scott R. Shannon, Aug 13 2020
The initial pattern of odd and even terms: (odd, even, even, odd), repeat, is misleading as it does not persist. (See A337644 for more about this point.)
Discussion of when primes first divide some term, from N. J. A. Sloane, Oct 21 2020: (Start)
When an odd prime p first divides a term of the Enots Wolley sequence (the present sequence), that term a(n) is equal to q*p where q
We conjecture that even if p is introduced by some prime q>2, 2*p appears later.
Sequence A337275 lists the index k such that a(k) = 2*prime(n), or -1 if 2*prime(n) is missing, and A338074 lists the indices k such that a(k) is twice a prime.
Comparison of those two sequences shows that they appear to be essentially identical (see the table in A337275).
The differences between the two sequences are caused by the fact that although normally if p and q are odd primes with p < q, then 2p precedes 2q, this is not true for the following primes: (7,5), (31,29), and (109, 113, 107), which appear in the order shown. We conjecture that these are the only exceptions.
Combining the above observations, we conjecture that for n >= 755 (at which point we have seen all the primes <= 367), every prime p is introduced by 2*p, and the terms 2*p appear in their natural order.
(End)

Crossrefs

A337007 and A337008 describe the overlap between successive terms.
See A337066 for when n appears, A337275 for when 2p appears, A337276 for when 2k appears, A337280 for when p first divides a term, A337644 for runs of three odd terms, A337645 & A338052 for smallest missing legal number, A337646 & A337647 for record high points, A338056 & A338057 for record high values for a(n)/n.
See A338053 & A338054 for the "early" terms.
Further properties of the present sequence are studied in A338062-A338071.
A338059 has the missing prime powers inserted (see also A338060, A338061).
See A338055, A338351 for variants.
A280864 is a different but very similar lexicographically earliest sequence.

Programs

  • Maple
    with(numtheory);
    N:= 10^4: # to get a(1) to a(n) where a(n+1) is the first term > N
    B:= Vector(N, datatype=integer[4]):
    for n from 1 to 2 do A[n]:= n: od:
    for n from 3 do
      for k from 3 to N do
        if B[k] = 0 and igcd(k, A[n-1]) > 1 and igcd(k, A[n-2]) = 1 then
              if nops(factorset(k) minus factorset(A[n-1])) > 0 then
           A[n]:= k;
           B[k]:= 1;
           break;
              fi;
        fi
      od:
      if k > N then break; fi;
    od:
    s1:=[seq(A[i], i=1..n-1)]; # N. J. A. Sloane, Sep 24 2020, based on Theorem 1 and Robert Israel's program for sequence A098550
  • Mathematica
    M = 1000;
    A[1] = 1; A[2] = 2;
    Clear[B]; B[_] = 0;
    For[n = 3, True, n++,
    For[k = 3, k <= M, k++,
    If[B[k] == 0 && GCD[k, A[n-1]] > 1 && GCD[k, A[n-2]] == 1, If[Length[ FactorInteger[k][[All, 1]] ~Complement~ FactorInteger[A[n-1]][[All, 1]]] > 0, A[n] = k; B[k] = 1; Break[]]]]; If[k > M, Break[]]];
    Array[A, n-1] (* Jean-François Alcover, Oct 20 2020, after Maple *)
  • Python
    from math import gcd
    from sympy import factorint
    from itertools import count, islice
    def agen(): # generator of terms
        a, seen, minan = [1, 2], {1, 2}, 3
        yield from a
        for n in count(3):
            an, fset = minan, set(factorint(a[-1]))
            while True:
                if an not in seen and gcd(an, a[-1])>1 and gcd(an, a[-2])==1:
                    if set(factorint(an)) - fset > set():
                        break
                an += 1
            a.append(an); seen.add(an); yield an
            while minan in seen: minan += 1
    print(list(islice(agen(), 70))) # Michael S. Branicky, Jan 22 2022

Extensions

Added "infinite" to definition. - N. J. A. Sloane, Sep 03 2020
Added Scott R. Shannon's name "Enots Wolley" (Yellowstone backwards) for this sequence to the definition, since that has been mentioned in several talks. - N. J. A. Sloane, Oct 11 2020
Showing 1-10 of 17 results. Next