login
A380293
Triangle read by rows: T(n, k) (2 <= k <= n) is the smallest positive integer m >= k such that the digits of m expressed in base n are the same as the first digits in base k.
1
2, 9, 3, 4, 265, 4, 5, 117032, 2123333591, 5, 7, 44, 291720, 10757067, 6, 57, 449, 16879, 18042, 19032324921, 7, 8, 332930, 64, 2180306, 174631931663663360, 51981761666123, 8, 9, 9, 93, 839, 407917265, 50732175, 197761284636128964, 9, 10, 10, 133302001, 124343, 155133423353, 102616333034, 13663722656306465044, 1066338786883726756382, 10
OFFSET
2,1
COMMENTS
We only discuss the case n > k in the comments.
Generally a solution with an x-digit base n number and a y-digit base k number has n^(x-1) slightly larger than k^(y-1) for the later digits to offset the difference in the leading digit.
Write the equation with equal digits aligned, and except the leading digit, the value in base k is larger than in base n, and the differences can generate all sufficiently small numbers (because the ratio between successive differences does not exceed k). So to minimize the base n number compared to the base k number, we get 1(k-1)(k-1)... in base k and n, and if the base n number is still larger than the base k number, we must increase y-x by 1 and solve n^(x-1) >= k^(y-1) again.
With some calculation we can get that a solution with an x-digit base n number and a y-digit base k number exists iff (n+k-2)*n^(x-1)+n <= 2*(n-1)*k^(y-1)+k and n^(x-1) >= k^(y-1), and it's sufficient for n^(x-1)/k^(y-1) be in a nonempty range, so T(n, k) always exists.
FORMULA
T(n^x, n^y) = n^lcm(x, y).
T(n, 2) = n if 2^x <= n < 3*2^(x-1), n+1 if 3*2^(x-1) <= n < 2^(x+1)-1, n^2+n+1 if n=2^(x+1)-1 (x >= 2).
EXAMPLE
The triangle begins:
n\k [2] [3] [4] [5] [6] [7]
[2] 2;
[3] 9, 3;
[4] 4, 265, 4;
[5] 5, 117032, 2123333591, 5;
[6] 7, 44, 291720, 10757067, 6;
[7] 57, 449, 16879, 18042, 19032324921, 7;
...
T(5, 3) = 117032 because 117032 = 12221112112 in base 3 and 12221112 in base 5.
PROG
(PARI) mm(n, k, x)=ceil(x*log(k)/(log(n)-log(k)));
T(n, k)={if(n==k, return(n)); my(x=1, t=mm(n, k, x)); while((n+k-2)*n^t+n>2*(n-1)*k^(t+x)+k, x++; t=mm(n, k, x)); l=n^t-k^(t+x); v=d=s=vector(t+x); for(i=0, t+x-1, d[i+1]=k^i-floor(n^(i-x))); s[1]=d[1]; for(i=1, t+x-2, s[i+1]=d[i+1]+s[i]); for(j=1, t+x-1, jj=t+x-j; v[jj+1]=max(ceil((l-(k-1)*s[jj])/d[jj+1]), 0); l=l-v[jj+1]*d[jj+1]); v[1]=l; a=k^(t+x); for(y=1, t+x, a=a+v[y]*k^(y-1)); a};
CROSSREFS
Cf. A379651.
Sequence in context: A085093 A194025 A281383 * A275838 A323720 A021777
KEYWORD
nonn,base,tabl,changed
AUTHOR
Yifan Xie, Jan 19 2025
STATUS
approved