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.

A105214 Companion sequence to A103683: a(n) = k if A103683(k) = n; a(n) = 0 if n is not in {A103683}.

Original entry on oeis.org

1, 2, 3, 6, 4, 46, 5, 10, 7, 22, 8, 50, 9, 14, 11, 18, 12, 54, 13, 26, 21, 30, 15, 58, 16, 34, 17, 42, 19, 62, 20, 38, 25, 70, 31, 66, 23, 74, 29, 78, 24, 102982, 27, 86, 41, 82, 28, 102974, 35, 98, 33, 90, 32, 102978, 36, 102, 37, 106, 39, 102990, 40, 94, 71
Offset: 1

Views

Author

Leroy Quet and Robert G. Wilson v, Apr 13 2005

Keywords

Comments

A103683 is injective.
Inverse of A103683.
Conjecture: a(42 + 6*k) = 0. This would follow from the conjecture that for n >= 67, A103683(n) is divisible by 3 iff n == 3 mod 4 and by 2 iff n == 2 mod 4. - Robert Israel, May 12 2015
The conjecture is false; a(42) = 102982. - Rémy Sigrist, Jan 05 2022

Examples

			a(6) = 46 because A103683(46) = 6.
		

Crossrefs

Cf. A103683.

Programs

  • C
    See Links section.
  • Mathematica
    f[s_] := Block[{k = 1, l = Take[s, -3]}, While[ Union[ GCD[k, l]] != {1} || MemberQ[s, k], k++]; Append[s, k]]; Take[Ordering@ Nest[f, {1, 2, 3}, 200], 41] (* Robert G. Wilson v, Jun 26 2011 *)

Extensions

More terms from Rémy Sigrist, Jan 05 2022

A084937 Smallest number which is coprime to the last two predecessors and has not yet appeared; a(1)=1, a(2)=2.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 9, 8, 11, 13, 6, 17, 19, 10, 21, 23, 16, 15, 29, 14, 25, 27, 22, 31, 35, 12, 37, 41, 18, 43, 47, 20, 33, 49, 26, 45, 53, 28, 39, 55, 32, 51, 59, 38, 61, 63, 34, 65, 57, 44, 67, 69, 40, 71, 73, 24, 77, 79, 30, 83, 89, 36, 85, 91, 46, 75, 97, 52, 81
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 13 2003

Keywords

Comments

Equivalently, this is the lexicographically earliest sequence of positive numbers satisfying the condition that each term is relatively prime to the next two terms. - N. J. A. Sloane, Nov 03 2014
Empirically, the points lie roughly on two lines: if n == 2 mod 3 then a(n) ~= 2n/3, otherwise a(n) ~= 4n/3. See A249680-A249683 for the three trisections, and see also the Sigrist scatterplot. - N. J. A. Sloane, Nov 03 2014, Nov 04 2014
All primes and prime powers occur, and the primes occur in their natural order. For any prime p, p occurs before p^2 before p^3, ...
Empirically, this is a permutation of the natural numbers, with inverse A084933: a(A084933(n))=A084933(a(n))=n. It seems that there are no further fixed points after {1,2,3,8,33,39}. Empirically, a(n) mod 2 = A011655(n+1); ABS(a(n)-n) < n; a(3*n+1)>n; a(3*n+2)Reinhard Zumkeller, Dec 16 2007
For a(n) mod 3 see A249603. - N. J. A. Sloane, Nov 03 2014
A249694(n) = GCD(a(n),a(n+3)). - Reinhard Zumkeller, Nov 04 2014

Crossrefs

Cf. A084933 (inverse), A103683, A121216, A247665, A090252, A249603 (read mod 3), A249680, A249681, A249682, A249683 (trisections), A249694, A011655, A249684 (numbers that take a record number of steps to appear), A249685.
Indices of primes: A249602, and of prime powers: A249575.
Running counts of missing numbers: A249686, A250099, A250100; A249777, A249856, A249857.
Where a(3n)>a(3n+1): A249689.
See also A353706, A353709, A353710.

Programs

  • Haskell
    import Data.List (delete)
    a084937 n = a084937_list !! (n-1)
    a084937_list = 1 : 2 : f 2 1 [3..] where
       f x y zs = g zs where
          g (u:us) | gcd y u > 1 || gcd x u > 1 = g us
                   | otherwise = u : f u x (delete u zs)
    -- Reinhard Zumkeller, Jan 28 2012
    
  • Maple
    N:= 1000: # to get a(n) until the first entry > N
    a[1]:= 1: a[2]:= 2:
    R:= {$3..N}:
    for n from 3 while R <> {} do
      success:= false;
      for r in R do
        if igcd(r,a[n-1]) = 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); # Robert Israel, Dec 12 2014
  • Mathematica
    lst={1,2,3}; unused=Range[4,100]; While[n=Select[unused, CoprimeQ[#, lst[[-1]]] && CoprimeQ[#, lst[[-2]]] &, 1]; n != {}, AppendTo[lst, n[[1]]]; unused=DeleteCases[unused, n[[1]]]]; lst
    f[s_] := Block[{k = 1, l = Take[s, -2]}, While[ Union[ GCD[k, l]] != {1} || MemberQ[s, k], k++]; Append[s, k]]; Nest[f, {1, 2}, 67] (* Robert G. Wilson v, Jun 26 2011 *)
  • PARI
    taken(k,t=v[k])=for(i=3,k-1, if(v[i]==t, return(1))); 0
    step(k,g)=while(gcd(k,g)>1, k++); k
    first(n)=local(v=vector(n,i,i)); my(nxt=3,t); for(k=3,n, v[k]=step(nxt, t=v[k-1]*v[k-2]); while(taken(k), v[k]=step(v[k]+1,t)); if(v[k]==t, while(taken(k+1,t++),))); v \\ Charles R Greathouse IV, Aug 26 2016
  • Python
    from math import gcd
    A084937_list, l1, l2, s, b = [1,2], 2, 1, 3, set()
    for _ in range(10**3):
        i = s
        while True:
            if not i in b and gcd(i,l1) == 1 and gcd(i,l2) == 1:
                A084937_list.append(i)
                l2, l1 = l1, i
                b.add(i)
                while s in b:
                    b.remove(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 09 2014
    

Extensions

Entry revised by N. J. A. Sloane, Nov 04 2014

A352950 Lexicographically earliest infinite sequence of distinct nonnegative integers commencing 1,3,5,7 such that any four consecutive terms are pairwise coprime.

Original entry on oeis.org

1, 3, 5, 7, 2, 9, 11, 13, 4, 15, 17, 19, 8, 21, 23, 25, 16, 27, 29, 31, 10, 33, 37, 41, 14, 39, 43, 47, 20, 49, 51, 53, 22, 35, 57, 59, 26, 55, 61, 63, 32, 65, 67, 69, 28, 71, 73, 45, 34, 77, 79, 75, 38, 83, 89, 81, 40, 91, 97, 87, 44, 85, 101, 93, 46, 95, 103, 99, 52, 107, 109, 105
Offset: 1

Views

Author

David James Sycamore, Apr 10 2022

Keywords

Comments

The pairwise coprime relations found in the first four odd numbers 1,3,5,7 are preserved throughout in any run of four consecutive terms.
a(4n+5) is always even (and < a(4n+2)); n>=0.
The plot exhibits two distinct rays at first (upper/odd, lower/even), with no terms divisible by 6 until a(229), at which point the even ray switches to producing just 28 multiples of 6 until a(337)=168. At this point the original even ray is re-established, the odd ray divides into two (quasi-parallel) rays, and no further multiples of 6 are seen. Therefore it seems very unlikely that the sequence is a permutation of the nonnegative integers.
Primes p other than p = 2 appear in their natural order.

Examples

			3,5,7 are pairwise coprime and 2 is the smallest unused number coprime to all of them, therefore a(5)=2.
		

Crossrefs

Programs

A143345 Lexicographically earliest sequence such that a(n) is coprime to the preceding 4 terms (or n-1 terms if n<5) and does not occur earlier.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 4, 9, 13, 17, 19, 8, 15, 23, 29, 31, 14, 25, 27, 37, 41, 16, 35, 33, 43, 47, 26, 49, 45, 53, 59, 22, 61, 21, 65, 67, 32, 71, 51, 55, 73, 28, 79, 39, 83, 85, 38, 77, 69, 89, 97, 10, 91, 57, 101, 103, 20, 107, 63, 109, 113, 34, 95, 81, 121, 127, 46, 119, 75, 131, 137, 44, 133, 87, 115, 139, 52, 149, 93, 125, 151, 56, 143, 111, 145, 157, 62, 161, 99, 163, 167, 40, 169, 123, 173, 179, 50, 181
Offset: 1

Views

Author

M. F. Hasler, Jan 18 2011

Keywords

Comments

One possible extension of A084937, A103683 to N=4. Here, a(4)=5 is chosen such that a(n) is coprime to a(k) for 0 < k < n <= 4. Another choice is a(k)=k (k<=4), which yieds the different sequence A180348.
It appears that:
- no multiples of 6 occur in this sequence, so it is not a permutation of the integers.
- a(n)=3 (mod 6) iff n=3, n=8, n=13 or n=14+5k, k>0.
- a(n)=0 (mod 2) iff n= 2+5k, k>=0.
- powers of 2 occur in natural order.
- powers of 3 occur in natural order.
- powers of any prime p occur in natural order.
- powers of any number occur in natural order.

Programs

  • PARI
    print1("1,2,3"); a=[1,2,3,L=5]; unused=[4]; v=vector(#a,i,1); for(n=4,99, print1(","a[#a]); for(i=1,#unused,apply(x->gcd(x,unused[i]),a)==v | next; a=concat(vecextract(a,"^1"),unused[i]);unused=vecextract(unused,Str("^",i));next(2));L++;while(apply(x->gcd(x,L),a) !=v,unused=concat(unused,L++-1););a=concat(vecextract(a,"^1"),L))

A180348 Lexicographically earliest sequence such that a(n) is coprime to the preceding 4 terms and does not occur earlier; a(n) = n for n=1,2,3,4.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Jan 18 2011

Keywords

Comments

One possible generalization of A084937 resp. A103683 to N=4, cf. A143345 for a different version.

Programs

  • PARI
    N=99; print1("1, 2, 3"); a=[1, 2, 3, L=4]; unused=[]; v=vector(#a, i, 1); for(n=#a, N, print1(", "a[#a]); for(i=1, #unused, apply(x->gcd(x, unused[i]), a)==v || next; a=concat(vecextract(a, "^1"), unused[i]); unused=vecextract(unused, Str("^", i)); next(2)); L++; while(apply(x->gcd(x, L), a) !=v, unused=concat(unused, L++-1); ); a=concat(vecextract(a, "^1"), L))

A291588 Lexicographically earliest sequence of distinct positive terms such that for any n > 0 and k >= 0, gcd(a(n), a(n + 2^k)) = 1.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 11, 6, 13, 17, 8, 19, 9, 10, 23, 29, 14, 27, 25, 16, 31, 37, 12, 35, 41, 22, 43, 39, 20, 47, 49, 32, 33, 53, 26, 59, 61, 15, 67, 71, 28, 73, 45, 34, 79, 77, 38, 65, 83, 46, 89, 21, 40, 97, 91, 44, 51, 95, 58, 101, 103, 18, 55, 107, 52, 109
Offset: 1

Views

Author

Rémy Sigrist, Aug 27 2017

Keywords

Comments

For a nonempty subset of the natural numbers, say S, let f_S be the lexicographically earliest sequence of distinct positive terms such that, for any n > 0 and s in S, gcd(a(n), a(n + s)) = 1:
- f_S is well defined (we can always extend the sequence with a new prime number),
- f_S(1) = 1, f_S(2) = 2, f_S(3) = 3,
- all prime numbers appear in f_S, in increasing order,
- if a(k) = p for some prime p, then k <= p and max_{i=1..k} a(i) = p,
- in particular:
S f_S
--------- ---
{ 1 } A000027 (the natural numbers)
{ 2 } A121216
{ 1, 2 } A084937
{ 1, 2, 3 } A103683
{ 1, 2, 3, 4 } A143345
A000027 A008578 (1 alongside the prime numbers)
A000079 a (this sequence)
- see also Links section for the scatterplots of f_S for certain classical S sets,
- likely f_S = f_S' iff S = S'.
The motivation for this sequence is to have a sequence f_S for some infinite subset S of the natural numbers.

Examples

			a(1) = 1 is suitable.
a(2) must be coprime to a(2 - 2^0) = 1.
a(2) = 2 is suitable.
a(3) must be coprime to a(3 - 2^0) = 2, a(3 - 2^1) = 1.
a(3) = 3 is suitable.
a(4) must be coprime to a(4 - 2^0) = 3, a(4 - 2^1) = 2.
a(4) = 5 is suitable.
a(5) must be coprime to a(5 - 2^0) = 5, a(5 - 2^1) = 3, a(5 - 2^2) = 1.
a(5) = 4 is suitable.
a(6) must be coprime to a(6 - 2^0) = 4, a(6 - 2^1) = 5, a(6 - 2^2) = 2.
a(6) = 7 is suitable.
a(7) must be coprime to a(7 - 2^0) = 7, a(7 - 2^1) = 4, a(7 - 2^2) = 3.
a(7) = 11 is suitable.
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

A344307 a(n) is the smallest number not yet in the sequence that satisfies the following condition: if p is a prime factor of a(n), the next p terms are coprime to p.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 9, 8, 11, 13, 6, 17, 19, 10, 21, 23, 16, 29, 27, 20, 31, 37, 12, 41, 43, 14, 15, 47, 22, 53, 39, 32, 25, 49, 18, 59, 61, 34, 45, 67, 38, 71, 33, 28, 65, 73, 24, 79, 83, 46, 75, 89, 56, 97, 81, 44, 85, 101, 26, 87, 103, 62, 35, 57, 64, 107
Offset: 1

Views

Author

Sergio Pimentel, May 14 2021

Keywords

Comments

It is not clear if every positive integer is in the sequence.

Crossrefs

Programs

  • PARI
    See Links section.

Extensions

More terms from Rémy Sigrist, May 29 2021

A115928 Smallest number which is coprime to the last four predecessors and not occurring earlier; a(1)=1, a(2)=2, a(3)=3 & a(4)=4.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 9, 8, 11, 13, 15, 14, 17, 19, 23, 6, 25, 29, 31, 12, 35, 37, 41, 16, 21, 43, 47, 10, 27, 49, 53, 20, 33, 59, 61, 26, 45, 67, 71, 22, 39, 73, 79, 28, 51, 55, 83, 32, 57, 65, 77, 34, 69, 89, 91, 38, 75, 97, 101, 44, 63, 85, 103, 46, 81, 195, 107, 52, 87, 109, 113, 40, 93, 119
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2011

Keywords

Crossrefs

Programs

  • Mathematica
    f[s_] := Block[{k = 1, l = Take[s,-4]}, While[ Union[ GCD[k, l]] != {1} || MemberQ[s,k], k++]; Append[s,k]]; Nest[f, {1,2,3,4}, 70]
Showing 1-8 of 8 results.