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.

A353718 Lengths of runs of identical terms in A353710.

Original entry on oeis.org

1, 1, 1, 3, 8, 40, 3, 20, 10, 4, 95, 60, 77, 227, 498, 162, 438, 988, 334, 946, 1342, 13633, 1446, 810, 103, 140, 7033, 2518, 2369, 5096, 1719, 300, 2397, 14590, 434, 6539, 26193, 20403, 13857, 10, 26972, 24908, 44745, 3346, 149938, 5859, 29919, 132184, 123679
Offset: 1

Views

Author

N. J. A. Sloane, May 09 2022

Keywords

Examples

			The first 60 terms of A353710 are 0, / 1, / 2, / 3, 3, 3, / 5, 5, 5, 5, 5, 5, 5, 5, / 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, / 11, 11, 11, / 15, 15, 15, ... The slashes indicate the initial runs of lengths 1, 1, 1, 3, 8, 40, 3, ...
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A353718_gen(): # generator of terms
        s, a, b, c, ab, k = {0,1}, 0, 1, 2, 1, 1
        yield from (1,1)
        while True:
            for n in count(c):
                if not (n & ab or n in s):
                    a, b = b, n
                    ab = a|b
                    s.add(n)
                    if c in s:
                        yield k
                        k = 0
                        while c in s:
                            c += 1
                    k += 1
                    break
    A353718_list = list(islice(A353718_gen(),20)) # Chai Wah Wu, May 10 2022

Extensions

More terms from Rémy Sigrist, May 09 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

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

A353723 Indices of records in A353717.

Original entry on oeis.org

0, 1, 2, 3, 5, 7, 11, 15, 23, 27, 29, 31, 39, 47, 55, 61, 63, 95, 111, 123, 127, 191, 255, 431, 443, 447, 495, 511, 639, 703, 759, 763, 767, 879, 895, 943, 959, 1007, 1023, 1727, 1775, 1791, 1919, 2015, 2047, 2559, 3007, 3063, 3071, 3583, 3839, 3967, 4031, 4063, 4079, 4095, 6111, 6127, 6143, 7135, 7165, 7167, 7671, 7679, 7935, 8063, 8183, 8191, 11775, 11999, 12031
Offset: 1

Views

Author

Rémy Sigrist and N. J. A. Sloane, May 10 2022

Keywords

Comments

These are the numbers that are the slowest to appear in A353709.
Also distinct values of A353710; a(n) appears A353718(n) times in A353710.

Crossrefs

Showing 1-4 of 4 results.