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.

Previous Showing 21-30 of 44 results. Next

A121216 a(1)=1, a(2) = 2; thereafter a(n) = the smallest positive integer which does not occur earlier in the sequence and which is coprime to a(n-2).

Original entry on oeis.org

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

Views

Author

Leroy Quet, Aug 20 2006

Keywords

Comments

Permutation of the positive natural numbers with inverse A225047: a(A225047(n)) = A225047(a(n)) = n. - Reinhard Zumkeller, Apr 25 2013
I confirm that this is a permutation. - N. J. A. Sloane, Mar 28 2015 [This can be proved using an argument similar to (but simpler than) the proof in A093714. - N. J. A. Sloane, May 05 2022]

Crossrefs

Programs

  • Haskell
    import Data.List (delete, (\\))
    a121216 n = a121216_list !! (n-1)
    a121216_list = 1 : 2 : f 1 2 [3..] where
    f x y zs = g zs where
      g (u:us) = if gcd x u == 1 then h $ delete u zs else g us where
       h (v:vs) = if gcd y v == 1 then u : v : f u v (zs \\ [u,v]) else h vs
    -- Reinhard Zumkeller, Apr 25 2013
  • Mathematica
    Nest[Append[#, Block[{k = 3}, While[Nand[FreeQ[#, k], GCD[#[[-2]], k] == 1], k++]; k]] &, {1, 2}, 70] (* Michael De Vlieger, Dec 26 2019 *)

Extensions

Extended by Ray Chandler, Aug 22 2006

A353709 a(0)=0, a(1)=1; thereafter a(n) = smallest nonnegative integer not among the earlier terms of the sequence such that a(n) and a(n-2) have no common 1-bits in their binary representations and also a(n) and a(n-1) have no common 1-bits in their binary representations.

Original entry on oeis.org

0, 1, 2, 4, 8, 3, 16, 12, 32, 17, 6, 40, 64, 5, 10, 48, 65, 14, 128, 33, 18, 68, 9, 34, 20, 72, 35, 132, 24, 66, 36, 25, 130, 96, 13, 144, 98, 256, 21, 42, 192, 257, 22, 104, 129, 258, 28, 97, 384, 26, 37, 320, 136, 7, 80, 160, 11, 84, 288, 131, 76, 272, 161, 70, 264, 49, 134, 328, 512, 19, 44, 448, 513, 30, 224, 768, 15, 112, 640, 259, 52, 200, 514, 53
Offset: 0

Views

Author

N. J. A. Sloane, May 06 2022

Keywords

Comments

A set-theory analog of A084937.
Conjecture: This is a permutation of the nonnegative numbers.

Crossrefs

Cf. A084937 (number theory analog), A109812, A121216, A353405 (powers of 2), A353708, A353710, A353715 and A353716 (a(n)+a(n+1)), A353717 (inverse), A353718, A353719 (primes), A353720 and A353721 (Records).
For the numbers that are the slowest to appear see A353723 and A353722.

Programs

A270139 a(n)=n when n<=3, otherwise a(n) is the smallest unused positive integer which is not coprime to the two previous terms.

Original entry on oeis.org

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

Views

Author

Ivan Neretin, Mar 11 2016

Keywords

Comments

Other possible conditions on a(n) with respect to its common factors with a(n-2) and a(n-1) lead to the following:
Coprime to both: A084937.
Coprime to the latter and not the former: A098550.
Coprime to the former and not the latter: with any initial conditions, the sequence "paints itself into a corner", i.e., is finite. With the added condition of a(n) having an extra prime factor not contained in a(n-1), it is A336957.
Coprime to the latter, regardless of the former: simply A000027.
Coprime to the former, regardless of the latter: A121216.
Non-coprime to the latter, regardless of the former: A064413.
Non-coprime to the former, regardless of the latter: A121217.

Examples

			a(12) = 30, a(13) = 35, so a(14) must have common factors (possibly different) with 30 and 35, and the smallest unused number with that property turns out to be 14, so a(14) = 14.
		

Crossrefs

Programs

  • Mathematica
    a = {1, 2, 3}; Do[k = 1; While[(MemberQ[a, k] || GCD[a[[-1]], k] == 1 || GCD[a[[-2]], k] == 1), k++]; AppendTo[a, k], {n, 2, 68}]; a

A085229 Smallest number which is coprime to n and to a(n-1), and is not yet in the sequence; a(1)=1.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jun 22 2003

Keywords

Comments

Permutation of natural numbers with inverse A085230: a(A085230(n))=A085230(a(n))=n.
From Michael De Vlieger, Apr 13 2022: (Start)
Theorem 1: 2 | a(2k+1) for k > 0, consequence of the lexically earliest and coprimality axioms. Even numbers appear in order as a consequence of the latter axiom and since numbers are either even or odd.
Corollary: the only fixed point is a(1) = 1.
Theorem 2: Generally, if prime p | a(n) then p is coprime to a(n +/- 1). For p = 2, 2 | a(2k+1) for k > 0 since 2 is the smallest prime. For odd p it is not necessarily true that given p | a(n) -> p | a(n+2) or p | a(n-2), since there may be a smaller m such that (a(n-1), m) = 1, q | m for prime q < p, and is not in a(1..n-1).
For these reasons, if we also set a(2) = 3, then we need not also check (n, a(n)) = 1, since it isn't possible. If we do not check (n, a(n)) = 1 and set a(2) = 3, 2 would follow 1 since 1 is coprime to all numbers.
Theorem 3: 3 | a(3k+1) for k > 1. Proof: For even k, 6 | a(3k+1), i.e., 6 | a(n) : n mod 6 = 1, and it is easy to see that since even numbers appear in order in the sequence, these even multiples of 3 are also in order. Because 3 | a(n) : n mod 6 = 1, we cannot have 3 | a(n) for n congruent to 0 or 2 (mod 6). Furthermore, we know that 2 | a(n) for n congruent to 3 or 5 (mod 6). So 3 | a(n) odd : n mod 6 = 4, that is, 3 | a(3k+1) for k > 1.
Theorem 4: Odd primes q set records. Proof: (q, a(n-1)) = 1 as a consequence of lexically earliest axiom that rules out equality, and by the definition of prime. 2 is displaced on account of the axiom that bans equality between n and a(n). Therefore, whereupon q is the smallest unused odd number, it enters the sequence.
A consequence of theorems 1 and 3 is that powers of 2 and those of 3 excepting 3 itself do not set records, since their adjacency is governed by a(n-1). The powers of other primes do set records since coprimality does not depend on multiplicity.
The smallest composite record is a(24) = 25. Smallest record m with omega(m) > 1 is a(54) = 55. Powers of 2 and 3 are absent from records for n <= 2^20. (End)

Crossrefs

Programs

A103683 a(1)=1, a(2)=2, a(3)=3, a(n) = smallest positive integer not occurring earlier in sequence and coprime to a(n-1), a(n-2) and a(n-3).

Original entry on oeis.org

1, 2, 3, 5, 7, 4, 9, 11, 13, 8, 15, 17, 19, 14, 23, 25, 27, 16, 29, 31, 21, 10, 37, 41, 33, 20, 43, 47, 39, 22, 35, 53, 51, 26, 49, 55, 57, 32, 59, 61, 45, 28, 67, 71, 65, 6, 73, 77, 79, 12, 83, 85, 89, 18, 91, 95, 97, 24, 101, 103, 107, 30, 109, 113, 119, 36, 115, 121, 127, 34
Offset: 1

Views

Author

Leroy Quet, Mar 26 2005

Keywords

Comments

Conjectured to be not a permutation of the natural numbers.
Charles R Greathouse IV extended this, and confirms that primes occur in natural order. - Jonathan Vos Post and M. F. Hasler, Jan 18 2011
Conjecture: for n >= 67, a(n) is even if and only if n == 2 (mod 4) and divisible by 3 if and only if n == 3 (mod 4). In particular, this implies the last value divisible by 6 is a(66) = 36. - Robert Israel, May 12 2015
a(102982) = 42, see A105214. Conjecture above is false. - Sergio Pimentel, Apr 18 2022

Crossrefs

Programs

  • Maple
    ina:= proc(n) false end:
    a:= proc(n) option remember; local k;
          if n<4 then k:= n
        else for k from 4 while ina(k) or igcd(k, a(n-1))<>1 or
                    igcd(k, a(n-2))<>1 or igcd(k, a(n-3))<>1
             do od
          fi; ina(k):= true; k
        end:
    seq(a(n), n=1..120);  # Alois P. Heinz, Jan 19 2011
  • Mathematica
    f[s_] := Block[{k = 1, l = Take[s, -3]}, While[ Union[ GCD[k, l]] != {1} || MemberQ[s, k], k++]; Append[s, k]]; Nest[f, {1, 2, 3}, 70] (* Robert G. Wilson v, Jun 26 2011 *)
  • Python
    from math import gcd
    from itertools import islice
    def agen(): # generator of terms
        aset, b, c, d = {1, 2, 3, 5}, 2, 3, 5
        yield from [1, b, c, d]
        while True:
            k = 1
            while k in aset or any(gcd(t, k) != 1 for t in [b, c, d]): k+= 1
            b, c, d = c, d, k
            aset.add(k)
            yield k
    print(list(islice(agen(), 70))) # Michael S. Branicky, Apr 18 2022

Extensions

More terms from Robert G. Wilson v, Mar 30 2005

A350359 Lexicographically earliest infinite sequence of distinct positive integers such that for any four consecutive terms a,b,c,d, d is prime to a and c, but not to b.

Original entry on oeis.org

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

Views

Author

David James Sycamore, Dec 26 2021

Keywords

Comments

The sequence preserves throughout the coprime relations found in the first four positive integers 1,2,3,4 (4 is prime to 1 and 3 but not to 2).
A prime term p at a(n) is necessarily preceded at a(n-2) by a multiple m*p of p, and followed at a(n+2) by a different multiple w*p of p (m,w > 1).
The sequence is infinite. Proof: For successive terms a,b,c,d we can choose a multiple e = q*c of c, where q is any prime which divides neither b nor d and such that e is not a prior term. Then e is prime to b and d but not to c, and since it has not been seen before we have at least one candidate for the term following d, which we choose as the least such number.
The definition implies that there can be no consecutive even terms (since then they would not be coprime). However, consecutive odd terms are not excluded, and do occur (eg 21 can follow 25 because they are coprime). Although two adjacent primes is possible, and does occur (a(9)=5, a(10)=7), three is not, since consecutive distinct primes p,q,r would imply gcd(p,r)>1.
Similar sequences with the same coprime relations as in 1,2,3,4 can be generated from any start terms a,b,c,d with b=a+1,c=b+1,d=c+1, provided a is congruent to 1 or 5 mod 6 (A007310).
Conjecture: The sequence is a permutation of the positive integers in which the primes appear in their natural order.

Examples

			From the definition a(k)=k for 1 <= k <= 4. a(5) = 9 since 9 is prime to 2 and 4 but not to 3, and is the smallest number with this property. Likewise a(6) = 8 since 8 is prime to 3 and 9 but not to 4.
		

Crossrefs

Programs

  • Maple
    N := 1000:
    a[1] := 1; a[2] := 2; a[3] := 3; a[4] := 4:
    R := {$5 .. N)};
    for n from 5 while R <> {} do
       success := false;
       for r in R do
         if igcd(r, a[n-1]) = 1 and igcd(r, a[n-3]) = 1 and igcd(r, a[n-2]) > 1 then
         a[n] := r;
         R := R minus {r};
         success := true;
         break
       fi
      od:
      if not success then break fi;
      od:
    seq(a[i], i = 1 .. n-1)
  • Mathematica
    Nest[Block[{s = #, a, b, c, k = 4}, Set[{a, b, c}, #[[-3 ;; -1]]]; While[Nand[FreeQ[s, k], GCD[a, k] == 1, GCD[b, k] > 1, GCD[c, k] == 1], k++]; Append[s, k]] &, Range[3], 68] (* Michael De Vlieger, Dec 26 2021 *)
  • PARI
    { s=0; for (n=1, #a=vector(71), if (n<=3, a[n]=n, for (v=0, oo, if (!bittest(s,v) && gcd(v,a[n-2])>1 && gcd(v,lcm(a[n-3],a[n-1]))==1, a[n]=v; break))); s+=2^a[n]; print1(a[n]", ")) } \\ Rémy Sigrist, Mar 27 2022

A351625 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with the largest previous term.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, May 04 2022

Keywords

Comments

The sequence differs from A352976 after twenty-six terms. See the examples below.
In the first 100000 terms the maximum run of even and odd terms is three and five respectively; it is unknown if these runs have a maximum number of terms or are unbounded. The fixed points beyond 2 are 15, 25, 35, and it is likely no more exist. The primes appear in their natural order, and it is conjectured that this is a permutation of the positive integers.
From Michael De Vlieger, May 08 2022: (Start)
Let u be the smallest missing number in a(1..n-1) and let record r = max(a(1..n-1)).
Theorem: For odd prime q, r = mq -> q. Proof: generally, q may either divide or be coprime to r, but since equality and coprimality are prohibited by definition, primes may only divide records. This implies q serves as local minima, hence u > 2 is always an odd prime and r > 1 is always even.
Since r is always even, r is nondecreasing and even numbers appear in natural order. Also, r = 2q -> q, similar to the Lagarias-Rains-Sloane chain in the EKG sequence but without the successor 3q.
Theorem: a(n) = k such that k is odd iff least prime factor q | k and q | r. Proof: sequence definition demands smallest missing number such that (r,k) > 1. Otherwise, a(n) = a(n-1) + 2, since (a(n-1), a(n-1) + 2) > 1, and all smaller even numbers have already appeared.
All even numbers and primes appear, and every odd composite k has a least prime factor that admits k into the sequence on the occasion of (r,k) > 1.
There are 3 trajectories in scatterplot for a(n) > 1. The trajectory with lowest apparent slope is that of the primes, i.e., local minima. The trajectory with highest slope is that of records, i.e., even numbers, and the remaining numbers are odd composites. (End)

Examples

			a(6) = 8 as the largest value of all previous terms is a(4) = 6, and 8 is the smallest unused number that shares a factor with 6.
a(27) = 32 as the largest value of all previous terms is a(24) = 30, and 32 is the smallest unused number that shares a factor with 30. Note that A352976(27) = 33 as it must share a factor with max(25,27) = 27.
		

Crossrefs

Programs

A351626 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with both the largest and second largest value of all previous terms.

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 15, 22, 24, 26, 28, 30, 21, 32, 34, 36, 38, 40, 42, 35, 44, 33, 46, 48, 50, 45, 52, 54, 39, 56, 58, 60, 62, 64, 66, 68, 51, 70, 72, 63, 74, 76, 78, 57, 80, 65, 75, 82, 84, 86, 88, 90, 55, 92, 69, 94, 96, 98, 100, 102, 85, 104, 106, 108, 110, 99, 105, 112, 77
Offset: 1

Views

Author

Scott R. Shannon, May 04 2022

Keywords

Comments

The sequence contains no primes or prime powers other than the powers of 2. As the sequence starts with 2 and 4, these terms being the largest and second largest values, the following terms will be even. This pattern continues until a term equal to the product of two or more odd primes occurs that shares a factor with the previous two largest even values and is smaller than the largest value plus 2. It is not possible for this value to be a prime larger than 2, or a power of such a prime, as the two terms with which it must share a factor differ by 2. It therefore cannot be between them either so it must be less than the second largest even term. Thus the next term after this odd composite must still share a factor with the two largest even values, and this will be the largest value plus 2 or another smaller odd composite. Therefore two more even values eventually become the two largest terms again, and thus the pattern of the two largest even terms, differing by two, interrupted by odd composites continues. Therefore no primes or prime powers other than powers of 2 will occur.
In the first 200000 terms the maximum run of even and odd terms is twelve and seven respectively; it is unknown if these runs have a maximum number of terms or are unbounded. The fixed points beyond 2 in the same range are 573, 597, 633, 6487, 21865, 22115, although it is likely more exist.

Examples

			a(5) = 8 as the largest and second-largest values of all previous terms are a(4) = 6 and a(3) = 4, and 8 is the smallest unused number that shares a factor with both of these values.
a(12) = 15 as the largest and second-largest values of all previous terms are a(11) = 20 and a(10) = 18, and 15 is the smallest unused number that shares a factor with both of these values.
		

Crossrefs

A352943 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with the sum of the largest and second largest value of all previous terms.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, May 06 2022

Keywords

Comments

The sequence contains long runs on even terms, differing by 2, and odd terms, differing by various small even numbers. These runs are often interrupted by a large prime that becomes the new largest term. As this and the previous largest term are typically much larger than any other value the sequence then begins a long series of steadily increasing values that share a factor with the sum of these two largest terms.
The sequence is conjectured to be a permutation of the positive integers, although it apparently takes many terms for some primes to appear, e.g., after 200000 terms 73 has not occurred. The primes do not occur in their natural order. Beyond the first three terms there are nine fixed points in the first 200000 terms, although it is likely more exist.

Examples

			a(4) = 5 as the sum of the largest and second-largest value of all previous terms is a(3) + a(2) = 3 + 2 = 5, and 5 is the smallest unused number that shares a factor with 5.
a(10) = 8 as the sum of the largest and second-largest value of all previous terms is a(8) + a(7) = 17 + 11 = 28, and 8 is the smallest unused number that shares a factor with 28.
		

Crossrefs

Programs

A352968 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with min(a(n-2),a(n-1)).

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Apr 12 2022

Keywords

Comments

Although all primes likely appear they do not occur in their natural order, e.g., 17 appears before 13. In the range studied each time a prime appears, beyond the initial 2 and 3, the next term is a multiple of the same prime. The largest multiple in the first 500000 terms is eight, first occurring at a(446271) = 64403, a(446272) = 515224. It is unknown if this ratio is unbounded for large n. Similarly the smaller of the two terms before a prime is a multiple of the prime. The largest ratio found being seven, first occurring at a(446271) = 64403, the same term as above.
In the first 500000 terms there are thirty-eight fixed points - 1, 2, 3, 4, 14, 32, 85, ..., 3277, 8651, 9223. It is likely no more exist. The sequence is conjectured to be a permutation of the positive integers.

Examples

			a(4) = 4 as min(a(2),a(3)) = min(2,3) = 2, and 4 is the smallest unused number that shares a factor with 2.
a(5) = 6 as min(a(3),a(4)) = min(3,4) = 3, and 6 is the smallest unused number that shares a factor with 3.
		

Crossrefs

Programs

Previous Showing 21-30 of 44 results. Next