A348041 Square array read by antidiagonals. A(n,k) is the nearest common ancestor of n and k in the Doudna tree (A005940).
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
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)
Links
- Michael De Vlieger, Doudna Tree diagram showing 8 rows.
- Index entries for sequences computed from indices in prime factorization
Crossrefs
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(u^2, v^2) = A(u, v)^2.
A(4k+2, 6k+3) = A064989(2k+1) for all k >= 1.
Comments