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).

This page as a plain text file.
%I A348041 #24 Nov 03 2021 22:31:59
%S A348041 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,
%T A348041 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,
%U A348041 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
%N A348041 Square array read by antidiagonals. A(n,k) is the nearest common ancestor of n and k in the Doudna tree (A005940).
%C A348041 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), ... .
%C A348041 Also the nearest common ancestor of n and k in the tree depicted in A163511 (the mirror image of the Doudna tree).
%C A348041 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.
%C A348041 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.
%H A348041 Michael De Vlieger, <a href="/A005940/a005940_1.png">Doudna Tree diagram</a> showing 8 rows.
%H A348041 <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>
%F A348041 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)).
%F A348041 A(i, j) = A(j, i).
%F A348041 A(n, n) = n.
%F A348041 A(2, n) = 2 for all n > 1.
%F A348041 A(p, q) = min(p, q) for any primes p and q.
%F A348041 A(A070003(n), A102750(m)) = 2.
%F A348041 A(u^2, v^2) = A(u, v)^2.
%F A348041 A(4k+2, 6k+3) = A064989(2k+1) for all k >= 1.
%e A348041 The top left 17x17 corner of the array:
%e A348041   n/k |  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17
%e A348041 ------+-------------------------------------------------------------
%e A348041     1 |  1, 1, 1, 1, 1, 1, 1, 1, 1,  1,  1,  1,  1,  1,  1,  1,  1,
%e A348041     2 |  1, 2, 2, 2, 2, 2, 2, 2, 2,  2,  2,  2,  2,  2,  2,  2,  2,
%e A348041     3 |  1, 2, 3, 2, 3, 3, 3, 2, 2,  3,  3,  3,  3,  3,  3,  2,  3,
%e A348041     4 |  1, 2, 2, 4, 2, 2, 2, 4, 4,  2,  2,  2,  2,  2,  2,  4,  2,
%e A348041     5 |  1, 2, 3, 2, 5, 3, 5, 2, 2,  5,  5,  3,  5,  5,  3,  2,  5,
%e A348041     6 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3,  6,  3,  3,  6,  2,  3,
%e A348041     7 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5,  7,  3,  7,  7,  3,  2,  7,
%e A348041     8 |  1, 2, 2, 4, 2, 2, 2, 8, 4,  2,  2,  2,  2,  2,  2,  8,  2,
%e A348041     9 |  1, 2, 2, 4, 2, 2, 2, 4, 9,  2,  2,  2,  2,  2,  2,  4,  2,
%e A348041    10 |  1, 2, 3, 2, 5, 3, 5, 2, 2, 10,  5,  3,  5,  5,  3,  2,  5,
%e A348041    11 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 11,  7,  3,  2, 11,
%e A348041    12 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3, 12,  3,  3,  6,  2,  3,
%e A348041    13 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 13,  7,  3,  2, 13,
%e A348041    14 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5,  7,  3,  7, 14,  3,  2,  7,
%e A348041    15 |  1, 2, 3, 2, 3, 6, 3, 2, 2,  3,  3,  6,  3,  3, 15,  2,  3,
%e A348041    16 |  1, 2, 2, 4, 2, 2, 2, 8, 4,  2,  2,  2,  2,  2,  2, 16,  2,
%e A348041    17 |  1, 2, 3, 2, 5, 3, 7, 2, 2,  5, 11,  3, 13,  7,  3,  2, 17,
%e A348041 .
%e A348041 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.
%e A348041 The nearest common ancestor of 12 and 15 in the Doudna tree is 6, thus A(12,15) = A(15,12) = 6.
%e A348041 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.
%e A348041 Example without reference to the Doudna tree: (Start)
%e A348041 The method below works in general for A(.,.) considered as a binary operation, but we use A(20, 42) as our example.
%e A348041 (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:
%e A348041   20 = 2*2*5 = prime(1) * prime(1) * prime(3) -> (1,1,3) -> (0,0,2) -> (0,0,2) -> (2,0,0);
%e A348041   42 = 2*3*7 = prime(1) * prime(2) * prime(4) -> (1,2,4) -> (0,1,3) -> (0,1,2) -> (2,1,0).
%e A348041 (2) Truncate each tuple after the first elements that differ between them (or at the length of the shorter tuple):
%e A348041   (2,0,0) -> (2,0); (2,1,0) -> (2,1).
%e A348041 (3) Choose the lesser tuple: (2,0).
%e A348041 (4) Determine which number would generate this tuple by the process from step (1):
%e A348041   10 = 2*5 = prime(1) * prime(3) -> (1,3) -> (0,2) -> (0,2) -> (2,0).
%e A348041 This gives A(20, 42) = 10.
%e A348041 (End)
%o A348041 (PARI)
%o A348041 up_to = 105;
%o A348041 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);};
%o A348041 Abinprefix(n,k) = { my(digs=binary(n)); fromdigits(vector(k,i,digs[i]),2); };
%o A348041 A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
%o A348041 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
%o A348041 A348040sq(x,y) = Abincompreflen(A156552(x), A156552(y));
%o A348041 A348041sq(x,y) = A005940(1+Abinprefix(A156552(x),A348040sq(x,y)));
%o A348041 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); };
%o A348041 v348041 = A348041list(up_to);
%o A348041 A348041(n) = v348041[n];
%o A348041 (PARI)
%o A348041 \\ A348041sq can be defined also as:
%o A348041 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)};
%o A348041 A252463(n) = if(!(n%2),n/2,A064989(n));
%o A348041 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)));
%Y A348041 Cf. A000027 (main diagonal).
%Y A348041 Cf. A000040, A005940, A052126, A061395, A064989, A070003, A102750, A156552, A163511, A241917, A347879 [= a(n,sigma(n))], A348040, A348041, A348042, A348043, A348044 [= a(n,n^2)].
%Y A348041 Cf. also A341510, A347380, A347381.
%K A348041 nonn,tabl
%O A348041 1,5
%A A348041 _Antti Karttunen_ and _Peter Munn_, Sep 27 2021