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 10 results.

A127203 a(n) = gcd(A127202(n), A127202(n+1)).

Original entry on oeis.org

1, 2, 1, 3, 1, 5, 1, 7, 2, 1, 3, 1, 11, 1, 13, 1, 3, 2, 1, 17, 1, 19, 2, 1, 3, 1, 23, 1, 5, 3, 1, 4, 1, 29, 1, 31, 1, 3, 1, 5, 1, 37, 1, 3, 1, 41, 1, 43, 2, 1, 3, 1, 47, 1, 7, 2, 1, 3, 2, 1, 53, 1, 5, 3, 1, 59, 1, 61, 1, 3, 2, 1, 5, 1, 67, 2, 1, 3, 1, 71, 1, 73, 1, 3, 2, 1, 7, 1, 79, 2, 1, 3, 1, 83, 1, 5, 2
Offset: 1

Views

Author

Leroy Quet, Jan 08 2007

Keywords

Comments

a(n) never equals a(n+1), by decree.
For the first 719 terms this coincides with the sequence {gcd(A280985(n), A280985(n+1))}. By decree, the latter may not contain two consecutive 1's. - N. J. A. Sloane, Jan 21 2017

Crossrefs

Programs

  • Mathematica
    f[l_List] := Block[{k = 1, c = GCD[l[[ -1]], l[[ -2]]]},While[MemberQ[l, k] || GCD[k, l[[ -1]]] == c, k++ ];Append[l, k]]; GCD @@@ Partition[Nest[f, {1, 2}, 100], 2, 1] (* Ray Chandler, Jan 16 2007 *)

Extensions

Extended by Ray Chandler, Jan 16 2007

A282712 Orbit of 23 under repeated applications of the map m -> A127202(m).

Original entry on oeis.org

23, 38, 33, 32, 28, 46, 41, 40, 35, 58, 51, 45, 42, 37, 62, 106, 95, 166, 298, 272, 260, 238, 217, 196, 177, 161, 150, 136, 121, 109, 194, 180, 326, 295, 538, 496, 460, 425, 389, 357, 327, 300, 276, 251, 230, 212, 382, 351, 321, 297, 542, 499, 459, 424, 396, 365, 335, 310, 566, 1042, 968, 899, 832, 771
Offset: 1

Views

Author

N. J. A. Sloane, Feb 28 2017

Keywords

Comments

It is known that A127202 is a permutation of the positive integers. The orbit containing 23 appears to be the first infinite orbit. See A282713 for the orbit of 23 under the inverse permutation, and see A127202 for other orbits (there are several small cycles).

Crossrefs

A282713 Orbit of 23 under repeated applications of the inverse of the map m -> A127202(m).

Original entry on oeis.org

23, 27, 31, 36, 39, 44, 50, 57, 65, 73, 82, 47, 53, 61, 68, 77, 87, 93, 104, 116, 131, 146, 83, 94, 54, 59, 66, 71, 80, 91, 101, 112, 126, 135, 145, 160, 172, 190, 204, 223, 244, 268, 293, 324, 352, 373, 406, 442, 482, 264, 279, 305, 336, 362, 201, 222, 241, 263, 289, 317, 346, 192, 210, 225, 236, 255
Offset: 1

Views

Author

N. J. A. Sloane, Feb 28 2017

Keywords

Comments

It is known that A127202 is a permutation of the positive integers. The orbit containing 23 appears to be the first infinite orbit. See A282713 for the orbit of 23 under the permutation itself, and see A127202 for other orbits (there are several small cycles).

Crossrefs

A280985 a(1)=1, and then a(n) = smallest positive integer not occurring earlier in the sequence sharing some prime factor with at least one of a(n-1) and a(n+1).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 12 2017

Keywords

Comments

In other words, for any n>1, gcd(a(n), a(n-1))*gcd(a(n), a(n+1)) > 1.
This sequence is related to A127202: here we require that the derived sequence b(n) = gcd(a(n), a(n+1)) does not contain two consecutive ones, there we require that the derived sequence c(n) = gcd(A127202(n), A127202(n+1)) (see A127203) does not contain two consecutive equal values; this sequence first differs from A127202 at n=720: a(720)=666 whereas A127202(720)=667.
This sequence is also related to the EKG sequence (A064413): here we require a common prime factor with at least one neighbor, there we require a common prime factor with both neighbors.
This sequence is a permutation of the natural numbers, with inverse A281117: Proof:
- The sequence is injective by definition,
- The sequence is surjective: by contradiction: let m be the least value missing from the sequence, and n0 the least value such that a(n)>m for any n>=n0; if a(n0) shares a prime factor with a(n0-1), then we can choose a(n0+1)=m; if a(n0) does not share a prime factor with a(n0-1), then a(n0+1) shares a prime factor with a(n0), and we can choose a(n0+2)=m: contradiction. QED

Examples

			The first terms, alongside the GCD with the next term, are:
n     a(n)     GCD
-     ----     ---
1        1       1
2        2       2
3        4       1
4        3       3
5        6       1
6        5       5
7       10       1
8        7       7
9       14       2
10       8       1
11       9       3
12      12       1
13      11      11
14      22       1
...    ...     ...
717    661     661
718   1322       2
719    664       2
720    666       1
721    667      23
		

Crossrefs

Cf. A064413, A127202 (agrees for first 719 terms), A127203, A281117, A283312.
For fixed points see A281353, for indices of primes see A338352.

Programs

  • Mathematica
    f[s_List] := Block[{g = GCD[s[[-2]], s[[-1]]], k = 3}, While[ MemberQ[s, k] || GCD[s[[-1]], k] == g, k++]; Append[s, k]]; Nest[f, {1, 2}, 65] (* Robert G. Wilson v, Mar 03 2017 *)

Formula

The following heuristic argument explains why the graph of this sequence is almost identical to the graph of A283312. Numbers appear in the sequence in their natural order, except when interrupted either by the appearance of a prime p, which is always followed by 2*p, or by a composite number c which needs to be followed by a missing number c' with gcd(c, c') > 1 (a(29) = 25 = c with a(30) = 30 = c' is an example). But c' is normally close to c, so those displacements have only a small local effect compared with the larger displacements caused by the primes. So the two lines in the graph are essentially defined by the same equations as the two lines in the graph of A283312. - N. J. A. Sloane, Nov 03 2020

A283312 a(n) = smallest missing positive number, unless a(n-1) was a prime in which case a(n) = 2*a(n-1).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 08 2017

Keywords

Comments

Comments from N. J. A. Sloane, Nov 02 2020: (Start)
Alternatively, this is the lexicographically earliest infinite sequence of distinct positive numbers such that every prime is followed by its double.
Theorem: This is a permutation of the positive integers.
Proof. Sequence is clearly infinite, so for any k there is a number N_0(k) such that n >= N_0(k) implies a(n) > k.
Suppose m is missing. Consider a(n) for n = N_0(m). Then a(n) must be a prime p (otherwise it would have been m, which is missing), a(n+1) = 2*p, and a(n+2) = m, a contradiction. QED.
(End)
A toy model of A280864, A280985, and A127202.
Alternative definition: a(1,2) = 1,2. Let P(k) = rad(a(1)*a(2)*...*a(k)), then for n > 2, a(n) = P(n)/P(n-1), where rad is A007947. - David James Sycamore, Jan 27 2024

Examples

			The offset is 1. What is a(1)? It is the smallest missing positive number, which is 1. Similarly, a(2)=2.
What is a(3)? Since the previous term was the prime 2, a(3) = 4.
And so on.
		

Crossrefs

See A283313 for smallest missing number, A338362 for inverse, A338361 for indices of primes, A338357 for first differences.
For records see A338356 and A001747.

Programs

  • Maple
    a:=[1];
    H:=Array(1..1000,0); MMM:=1000;
    H[1]:=1; smn:=2; t:=2;
    for n from 2 to 100 do
    if t=smn then a:=[op(a),t]; H[t]:=1;
       if isprime(t) then a:=[op(a),2*t]; H[2*t]:=1; fi;
       t:=t+1;
    # update smallest missing number smn
       for i from smn+1 to MMM do if H[i]=0 then smn:=i; break; fi; od;
    else t:=t+1;
    fi;
    od:
    a;
  • Mathematica
    Module[{nmax = 100, smn = 1}, Nest[Append[#, If[PrimeQ[Last[#]], 2*Last[#], While[MemberQ[#, ++smn]]; smn]]&, {1}, nmax-1]] (* Paolo Xausa, Feb 12 2024 *)

Formula

There is an explicit formula for the n-th term of the inverse permutation: see A338362.
The graph: Numbers appear in the sequence in their natural order, except when interrupted by the appearance of primes. Suppose a(n)=x, where x is neither a prime nor twice a prime. Then if p is a prime in the range x/2 < p < x, 2p appears in the sequence between p and p+1. Therefore we have the identity
n = x + pi(x) - pi(x/2). ... (1)
If a(n) = x = a prime, then (1) is replaced by
n = x + pi(x) - pi(x/2) - 1. ... (2)
If a(n) = x = twice a prime then
n = x/2 + pi(x/2) - pi(x/4). ... (3)
These equations imply that the lower line in the graph of the sequence is
x approx= n(1 - 1/(2*log n)) ... (4)
while the upper line is
x approx= 2n(1 - 1/(2*log n)). ... (5)
a(2*n-1 + A369610(n)) = prime(n). - David James Sycamore, Jan 27 2024

Extensions

Entry revised by N. J. A. Sloane, Nov 03 2020

A282028 If n is prime then a(n) = 2n, otherwise a(n) is the smallest missing number.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 16 2017

Keywords

Crossrefs

Programs

  • PARI
    first(n) = { my(res = vector(n), i = 1); for(x=1, n-1, if(isprime(x), res[x+1] = 2*x, if(setsearch(Set(res), i), i++); res[x+1]=i; i++)); res; } \\ Iain Fox, Nov 18 2017

Formula

If n is prime, a(n) = 2n, and these points line on the upper straight line in the graph.
If n is not a prime, after n terms we have seen all the numbers from 0 through a(n) and also the doubles of all the primes p in the range a(n)/2 < p < n.
So n = a(n) + pi(n) - pi(a(n)/2). In other words, if n is not a prime then a(n) is the unique solution to a(n) - pi(a(n)/2) = n - pi(n).
This implies that if n is not a prime, a(n) = n*(1 - 1/(2*log(n)) + o(1/log(n))).
These are the points on the lower line, which is not straight but has slope roughly equal to 1.

A281353 Fixed points in A280985.

Original entry on oeis.org

1, 2, 12, 18, 30, 56
Offset: 1

Views

Author

N. J. A. Sloane, Jan 21 2017

Keywords

Comments

Numbers n such that A280985(n)=n.
In the first 75000 terms there are no other fixed points.
A127202 is very similar to A280985, and in the first 10000 terms it has just these six fixed points.
It may be that there are no further fixed points in either sequence.

Crossrefs

A281354 a(n) = smallest missing number after A280985(n) has been computed.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 7, 8, 8, 9, 11, 11, 13, 13, 15, 15, 16, 16, 17, 19, 19, 20, 20, 21, 23, 23, 25, 25, 27, 27, 28, 29, 29, 31, 31, 33, 33, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43, 44, 44, 45, 47, 47, 49, 49, 50, 50, 51, 52, 52, 53, 55, 55, 57, 57, 59, 61, 61, 63, 63, 64, 64, 65, 67, 67, 68, 68, 69, 71, 71
Offset: 1

Views

Author

N. J. A. Sloane, Jan 21 2017

Keywords

Comments

Since A280985 and A127202 agree for the first 719 terms, for n < 719 this is also the smallest missing number after A127202(n) has been computed.

Crossrefs

A320123 a(1) = 1, a(2) = 2, a(3) = 3, and for any n > 3, a(n) = the smallest positive integer not yet in the sequence such that gcd(a(n-2), a(n-1)), gcd(a(n-1), a(n)) and gcd(a(n), a(n-2)) are all distinct.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 06 2018

Keywords

Comments

This sequence is a variant of A127202.
The sequence is well defined as for any n > 3, provided the first n terms are known, any number v of the form a(n-2) * b where b is coprime to a(n) * a(n-1) satisfies #{ gcd(a(n-1), a(n)), gcd(a(n), v), gcd(v, a(n-1)) } = #{ gcd(a(n-1), a(n)), gcd(a(n), a(n-2)), gcd(a(n-2), a(n-1)) } = 3, and a(n+1) exists.
In the scatterplot of the sequence, the prime numbers correspond to the lower line.

Examples

			The first terms, alongside gcd(a(n-2), a(n-1)), gcd(a(n-1), a(n)) and gcd(a(n), a(n-2)), are:
  n   a(n)  gcd(a(n-2),a(n-1))  gcd(a(n-1),a(n))  gcd(a(n),a(n-2))
  --  ----  ------------------  ----------------  ----------------
   1     1                 N/A               N/A               N/A
   2     2                 N/A                 1               N/A
   3     3                   1                 1                 1
   4     6                   1                 3                 2
   5     4                   3                 2                 1
   6     9                   2                 1                 3
   7    12                   1                 3                 4
   8     8                   3                 4                 1
   9    15                   4                 1                 3
  10    10                   1                 5                 2
  11    14                   5                 2                 1
  12     5                   2                 1                 5
  13    20                   1                 5                 2
  14    16                   5                 4                 1
  15    25                   4                 1                 5
		

Crossrefs

Cf. A127202.

Programs

  • PARI
    See Links section.

A384503 Lexicographically earliest infinite sequence of distinct positive integers having the property that for any pair a(n-2) = i, a(n-1) = j of consecutive terms > 1, a(n) is the smallest novel k such that gcd(i,k) > 1 if gcd(i,j) = 1 or gcd(j,k) = 1 if gcd(i,j) > 1.

Original entry on oeis.org

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

Views

Author

David James Sycamore, May 31 2025

Keywords

Comments

Three initial terms (1,2,3) are needed since starting 1,2 would require 1 to have a prime factor.
Similar to A280985 except that if for some m, a(m) = prime p, then a(m+2) = 2*p (whereas A280985(m+1) = 2*p).
Conjectured to be a permutation of the positive integers, with primes occurring in order.

Examples

			The lexicographically earliest condition requires that the sequence starts a(n) = n for n <= 3. Then with a(2) = 2 and a(3) = 3 a(4) must be 4, the smallest novel number sharing a prime divisor with 2 (since gcd(2,3) = 1). Since gcd(3,4) = 1, a(5) must be 6, the smallest novel number sharing a prime divisor with 3. Since gcd(4,6) > 1 a(6) = 5, the smallest novel number prime to a(4) = 4. a(8) = 8 because gcd(6,5) = 1 and then a(9) = 2*5 = 10 the smallest novel number sharing a factor with 5.
		

Crossrefs

Programs

  • Mathematica
    nn = 120; c[] := False; m[] := 1; c[1] = c[2] = c[3] = True; i = 2; j = 3; u = 4;
    Range[3]~Join~Reap[Do[
      If[CoprimeQ[i, j],
        If[PrimePowerQ[i],
          p = FactorInteger[i][[1, 1]]; While[c[p*m[p]], m[p]++]; k = p*m[p],
          k = u; While[Or[c[k], CoprimeQ[i, k]], k++] ],
        k = u; While[Or[c[k], ! CoprimeQ[j, k]], k++] ];
      Sow[k]; Set[{c[k], i, j}, {True, j, k}];
    If[k == u, While[c[u], u++]], {n, 3, nn}] ][[-1, 1]] (* Michael De Vlieger, May 31 2025 *)

Formula

For prime a(n) = p, a(n+2) = 2*p. - Michael De Vlieger, May 31 2025
Showing 1-10 of 10 results.