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-2 of 2 results.

A279125 Lexicographically earliest sequence such that, for any distinct i and j, a(i)=a(j) implies (i AND j)=0 (where AND stands for the bitwise AND operator).

Original entry on oeis.org

0, 0, 1, 0, 2, 3, 4, 0, 3, 2, 5, 1, 6, 7, 8, 0, 7, 6, 9, 5, 10, 11, 12, 4, 13, 14, 15, 16, 17, 18, 19, 0, 11, 10, 16, 9, 14, 13, 20, 12, 21, 22, 23, 24, 25, 26, 27, 1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 18, 17, 24, 15, 22, 21, 35, 9
Offset: 1

Views

Author

Rémy Sigrist, Dec 06 2016

Keywords

Comments

This sequence is similar to A279119 in the sense that here we check for common ones in binary representation and there we check for common prime factors.
By analogy with A275152, this sequence can be seen as a way to tile the first quadrant with fixed disconnected 2-dimensional polyominoes: the (vertical) polyomino corresponding to n is shifted to the right as little as possible so as not to overlap a previous polyomino, and a(n) gives the corresponding number of steps to the right (see illustration in Links section).

Crossrefs

Programs

  • Maple
    with(Bits):
    n:= 100:
    l:= []:
    g:=[seq(0, i = 0..n-1)]:
    for i from 1 to n by 1
    do
    a:= 0;
    while (And(g[a + 1], i)) > 0
    do
    a++;
    end do:
    g[a + 1] += i;
    l:= [op(l), a];
    end do:
    print(l); # Reza K Ghazi, Dec 29 2021
  • Mathematica
    n = 100;
    l = {};
    g = ConstantArray[0, n];
    For[i = 0, i < n, i++; a = 0; While[BitAnd[g[[a + 1]], i] > 0, a++];
      g[[a + 1]] += i;
      l = Append[l, a]];
    l (* Reza K Ghazi, Dec 29 2021 *)
  • PARI
    g = vector(72); for (n=1, #g, a = 0; while (bitand(g[a+1],n)>0, a++); g[a+1] += n; print1 (a", "))
    
  • Python
    n = 100
    g = n * [0]
    for i in range(1, n + 1):
        a = 0
        while g[a] & i:
            a += 1
        g[a] += i
        print(a, end=', ') # Reza K Ghazi, Dec 29 2021

Formula

a(n)=0 iff n belongs to A000079.
a(n)=1 iff n belongs to A164346.

A370822 Lexicographically earliest sequence of positive integers such that all equal terms appear at mutually coprime indices.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 4, 2, 5, 1, 6, 1, 7, 4, 8, 1, 9, 1, 10, 5, 11, 1, 12, 2, 13, 7, 14, 1, 15, 1, 16, 8, 17, 3, 18, 1, 19, 10, 20, 1, 21, 1, 22, 11, 23, 1, 24, 2, 25, 13, 26, 1, 27, 6, 28, 14, 29, 1, 30, 1, 31, 16, 32, 7, 33, 1, 34, 17, 35, 1, 36, 1, 37, 19
Offset: 1

Views

Author

Neal Gersh Tolunsky, Mar 02 2024

Keywords

Comments

See A279119 for the same sequence with numbers including 0.
See A055396 for a similar sequence where all equal terms share a factor > 1.

Examples

			a(4)=2 because if we had a(4)=1, then i=2 and i=4, which are not coprime indices, would have the same value 1. So a(4)=2, which is a first occurrence.
a(9)=2 because if we had a(9)=1, i=3 and i=9, would have the same value despite not being coprime indices. a(9) can be 2 because the only other index with a 2 is a(4)=2 and 4 is coprime to 9.
a(15)=4 because 4 is the smallest value such that every previous index at which a 4 occurs is coprime to i=15. In this case, 4 has only occurred at i=8 and 8 is coprime to 15.
		

Crossrefs

Programs

  • Python
    from math import gcd, lcm
    from itertools import combinations as C, count, islice
    def agen(): # generator of terms
        yield from [1, 1, 1]
        lcms = {1: 6}
        for n in count(4):
            an = next(an for an in count(1) if an not in lcms or gcd(lcms[an], n) == 1)
            yield an
            if an not in lcms: lcms[an] = n
            else: lcms[an] = lcm(lcms[an], n)
    print(list(islice(agen(), 75))) # Michael S. Branicky, Mar 02 2024

Formula

a(n) = 1 + A279119(n). - Rémy Sigrist, Mar 04 2024

Extensions

a(22) and beyond from Michael S. Branicky, Mar 02 2024
Showing 1-2 of 2 results.