%I #23 Sep 23 2018 22:30:26
%S 1,2,1,6,8,3,3,12,1,14,12,18,2,20,14,24,1,18,4,20,30,32,4,24,38,4,42,
%T 5,44,30,4,32,48,5,54,38,5,60,5,1,62,42,44,5,68,48,72,2,30,74,32,80,
%U 54,5,84,1,60,90,62,38,3,98,68,102,6,42,104,3,72,108,44,6,110,74,3,114,48,80
%N Smallest number b such that in base b the prime factors of the n-th semiprime (A001358) have equal lengths.
%C a(n) = 1 iff A001358(n) is the square of a prime (A001248);
%C a(A174956(A138511(n))) = A084127(A174956(A138511(n))) + 1.
%C Equally, 1 if A001358(n) = p^2, otherwise, if A001358(n) = p*q (p, q primes, p < q), then a(n) = A252375(n) = the least r such that r^k <= p < q < r^(k+1), for some k >= 0. - _Antti Karttunen_, Dec 16 2014
%C a(A174956(A085721(n))) <= 2. - _Reinhard Zumkeller_, Dec 19 2014
%H Reinhard Zumkeller, <a href="/A138510/b138510.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A251725(A001358(n)). - _Antti Karttunen_, Dec 16 2014
%e For n=31, the n-th semiprime is A001358(31) = 91 = 7*13;
%e 7 = 111_2 = 21_3 = 13_4
%e and 13 = 1101_2 = 111_3 = 31_4, so a(31) = 4. [corrected by _Jon E. Schoenfield_, Sep 23 2018]
%e .
%e Illustration of initial terms, n <= 25:
%e . n | A001358(n) = p * q | b = a(n) | p and q in base b
%e . ----+---------------------+-----------+-------------------
%e . 1 | 4 2 2 | 1 | [1] [1]
%e . 2 | 6 2 3 | 2 | [1,0] [1,1]
%e . 3 | 9 3 3 | 1 | [1,1,1] [1,1,1]
%e . 4 | ** 10 2 5 | 6 | [2] [5]
%e . 5 | ** 14 2 7 | 8 | [2] [7]
%e . 6 | 15 3 5 | 3 | [1,0] [1,2]
%e . 7 | 21 3 7 | 3 | [1,0] [2,1]
%e . 8 | ** 22 2 11 | 12 | [2] [11]
%e . 9 | 25 5 5 | 1 | [1]^5 [1]^5
%e . 10 | ** 26 2 13 | 14 | [2] [13]
%e . 11 | ** 33 3 11 | 12 | [3] [11]
%e . 12 | ** 34 2 17 | 18 | [2] [17]
%e . 13 | 35 5 7 | 2 | [1,0,1] [1,1,1]
%e . 14 | ** 38 2 19 | 20 | [2] [19]
%e . 15 | ** 39 3 13 | 14 | [3] [13]
%e . 16 | ** 46 2 23 | 24 | [2] [23]
%e . 17 | 49 7 7 | 1 | [1]^7 [1]^7
%e . 18 | ** 51 3 17 | 18 | [3] [17]
%e . 19 | 55 5 11 | 4 | [1,1] [2,3]
%e . 20 | ** 57 3 19 | 20 | [3] [19]
%e . 21 | ** 58 2 29 | 30 | [2] [29]
%e . 22 | ** 62 2 31 | 32 | [2] [31]
%e . 23 | 65 5 13 | 4 | [1,1] [3,1]
%e . 24 | ** 69 3 23 | 24 | [3] [23]
%e . 25 | ** 74 2 37 | 38 | [2] [37]
%e where p = A084126(n) and q = A084127(n),
%e semiprimes marked with ** indicate terms of A138511, i.e. b = q + 1.
%o (Haskell)
%o import Data.List (genericIndex, unfoldr); import Data.Tuple (swap)
%o import Data.Maybe (mapMaybe)
%o a138510 n = genericIndex a138510_list (n - 1)
%o a138510_list = mapMaybe f [1..] where
%o f x | a010051' q == 0 = Nothing
%o | q == p = Just 1
%o | otherwise = Just $
%o head [b | b <- [2..], length (d b p) == length (d b q)]
%o where q = div x p; p = a020639 x
%o d b = unfoldr (\z -> if z == 0 then Nothing else Just $ swap $ divMod z b)
%o -- _Reinhard Zumkeller_, Dec 16 2014
%o (Scheme) (define (A138510 n) (A251725 (A001358 n))) ;; _Antti Karttunen_, Dec 16 2014
%Y Cf. A078972, A085721.
%Y Cf. A138511, A251728, A252375, A084127, A020639, A162319, A174956, A001358.
%K nonn,base
%O 1,2
%A _Reinhard Zumkeller_, Mar 21 2008
%E Wrong comment corrected by _Reinhard Zumkeller_, Dec 16 2014