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.

A348041 Square array read by antidiagonals. A(n,k) is the nearest common ancestor of n and k in the Doudna tree (A005940).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 3, 2, 2, 3, 2, 1, 1, 2, 3, 2, 5, 2, 3, 2, 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, 1, 1, 2, 2, 4, 5, 6, 5, 4, 2, 2, 1, 1, 2, 3, 4, 2, 3, 3, 2, 4, 3, 2, 1, 1, 2, 3, 2, 2, 2, 7, 2, 2, 2, 3, 2, 1, 1, 2, 3, 2, 5, 2, 2, 2, 2, 5, 2, 3, 2, 1
Offset: 1

Views

Author

Antti Karttunen and Peter Munn, Sep 27 2021

Keywords

Comments

Array is symmetric and is read by antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ... .
Also the nearest common ancestor of n and k in the tree depicted in A163511 (the mirror image of the Doudna tree).
The first fork in the Doudna tree separates numbers divisible by the square of their largest prime factor (on one main branch) from other numbers greater than 2 (on the other main branch). If n and m are on different main branches then A(n, m) = 2.
In more general terms A(.,.) can be considered as a binary operation that evaluates certain differences between the prime factors of its operands. To start, compare the largest prime factor of each operand with the 2nd largest prime factor. As described above, 2 is the result if these 2 factors are the same in one operand, but are different in the other operand; otherwise 3 is the result if these 2 factors are consecutive primes in one operand, but are nonconsecutive primes in the other operand. Further cases are covered in the examples, but note it is the difference between the indices of the prime numbers that is significant.

Examples

			The top left 17x17 corner of the array:
  n/k |  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17
------+-------------------------------------------------------------
    1 |  1, 1, 1, 1, 1, 1, 1, 1, 1,  1,  1,  1,  1,  1,  1,  1,  1,
    2 |  1, 2, 2, 2, 2, 2, 2, 2, 2,  2,  2,  2,  2,  2,  2,  2,  2,
    3 |  1, 2, 3, 2, 3, 3, 3, 2, 2,  3,  3,  3,  3,  3,  3,  2,  3,
    4 |  1, 2, 2, 4, 2, 2, 2, 4, 4,  2,  2,  2,  2,  2,  2,  4,  2,
    5 |  1, 2, 3, 2, 5, 3, 5, 2, 2,  5,  5,  3,  5,  5,  3,  2,  5,
    6 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3,  6,  3,  3,  6,  2,  3,
    7 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5,  7,  3,  7,  7,  3,  2,  7,
    8 |  1, 2, 2, 4, 2, 2, 2, 8, 4,  2,  2,  2,  2,  2,  2,  8,  2,
    9 |  1, 2, 2, 4, 2, 2, 2, 4, 9,  2,  2,  2,  2,  2,  2,  4,  2,
   10 |  1, 2, 3, 2, 5, 3, 5, 2, 2, 10,  5,  3,  5,  5,  3,  2,  5,
   11 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 11,  7,  3,  2, 11,
   12 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3, 12,  3,  3,  6,  2,  3,
   13 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 13,  7,  3,  2, 13,
   14 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5,  7,  3,  7, 14,  3,  2,  7,
   15 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3,  6,  3,  3, 15,  2,  3,
   16 |  1, 2, 2, 4, 2, 2, 2, 8, 4,  2,  2,  2,  2,  2,  2, 16,  2,
   17 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 13,  7,  3,  2, 17,
.
The nearest common ancestor of 7 and 15 in the Doudna tree (see diagram in the links and A005940) is 3, thus A(7,15) = A(15,7) = 3.
The nearest common ancestor of 12 and 15 in the Doudna tree is 6, thus A(12,15) = A(15,12) = 6.
The nearest common ancestor of 4 and 27 is 4 because 27 is a descendant of 4 in the Doudna tree, thus A(4,27) = A(27,4) = 4.
Example without reference to the Doudna tree: (Start)
The method below works in general for A(.,.) considered as a binary operation, but we use A(20, 42) as our example.
(1) Write each operand as a product of primes in nondecreasing order, convert to a tuple of prime indices, decrement each index, take first differences, then reverse the order:
  20 = 2*2*5 = prime(1) * prime(1) * prime(3) -> (1,1,3) -> (0,0,2) -> (0,0,2) -> (2,0,0);
  42 = 2*3*7 = prime(1) * prime(2) * prime(4) -> (1,2,4) -> (0,1,3) -> (0,1,2) -> (2,1,0).
(2) Truncate each tuple after the first elements that differ between them (or at the length of the shorter tuple):
  (2,0,0) -> (2,0); (2,1,0) -> (2,1).
(3) Choose the lesser tuple: (2,0).
(4) Determine which number would generate this tuple by the process from step (1):
  10 = 2*5 = prime(1) * prime(3) -> (1,3) -> (0,2) -> (0,2) -> (2,0).
This gives A(20, 42) = 10.
(End)
		

Crossrefs

Cf. A000027 (main diagonal).
Cf. also A341510, A347380, A347381.

Programs

  • PARI
    up_to = 105;
    Abincompreflen(n, m) = { my(x=binary(n),y=binary(m),u=min(#x,#y)); for(i=1,u,if(x[i]!=y[i],return(i-1))); (u);};
    Abinprefix(n,k) = { my(digs=binary(n)); fromdigits(vector(k,i,digs[i]),2); };
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A156552(n) = {my(f = factor(n), p, p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ From A156552
    A348040sq(x,y) = Abincompreflen(A156552(x), A156552(y));
    A348041sq(x,y) = A005940(1+Abinprefix(A156552(x),A348040sq(x,y)));
    A348041list(up_to) = { my(v = vector(up_to), i=0); for(a=1,oo, for(col=1,a, i++; if(i > up_to, return(v)); v[i] = A348041sq(col,(a-(col-1))))); (v); };
    v348041 = A348041list(up_to);
    A348041(n) = v348041[n];
    
  • PARI
    \\ A348041sq can be defined also as:
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A252463(n) = if(!(n%2),n/2,A064989(n));
    A348041sq(x,y) = if(1==x||1==y,1, my(lista=List([]), i, k=x, stemvec, h=y); while(k>1, listput(lista,k); k = A252463(k)); stemvec = Vecrev(Vec(lista)); while(1, if((i=vecsearch(stemvec,h))>0, return(stemvec[i])); h = A252463(h)));

Formula

A(n, 1) = A(1, n) = 1; otherwise if A241917(n) <> A241917(m) then A(n, m) = A000040(1 + min(A241917(2*n), A241917(2*m))); otherwise A(n, m) = x * A000040(A061395(x)+A241917(n)), where x = A(A052126(n), A052126(m)).
A(i, j) = A(j, i).
A(n, n) = n.
A(2, n) = 2 for all n > 1.
A(p, q) = min(p, q) for any primes p and q.
A(A070003(n), A102750(m)) = 2.
A(u^2, v^2) = A(u, v)^2.
A(4k+2, 6k+3) = A064989(2k+1) for all k >= 1.