%I #16 Jun 30 2019 10:16:14
%S 1,1,1,1,1,2,1,1,1,6,1,2,1,8,3,1,1,2,1,6,3,12,1,2,1,14,1,8,1,6,1,1,12,
%T 18,2,2,1,20,14,6,1,8,1,12,3,24,1,2,1,6,18,14,1,2,4,8,20,30,1,6,1,32,
%U 3,1,4,12,1,18,24,8,1,2,1,38,3,20,4,14,1,6,1,42,1,8,5,44,30,12,1,6,4,24,32,48,5,2,1,8,12,6
%N Smallest number b such that in base-b representation the prime factors of n have equal lengths.
%C The "base-1" is here same as "unary base", where n is represented with digit "1" replicated n times. Thus if and only if n is in A000961 (is a power of prime), a(n) = 1. See A252375 for a more consistent treatment of those cases.
%H Antti Karttunen, <a href="/A251725/b251725.txt">Table of n, a(n) for n = 1..10000</a>
%F Other identities. For all n >= 1:
%F A138510(n) = a(A001358(n)).
%F a(n) = a(A066048(n)). [The result depends only on the smallest and the largest prime factor of n.]
%o (MIT/GNU Scheme)
%o ;; Factorization function ifactor can be found in _Antti Karttunen_'s IntSeq-library, and code for A162319bi given in A162319:
%o (define (A251725 n) (let ((spf (A020639 n)) (gpf (A006530 n))) (if (= spf gpf) 1 (let outerloop ((k 2)) (let innerloop ((r 1)) (cond ((and (<= r spf) (< gpf (* k r))) k) ((<= r spf) (innerloop (* k r))) (else (outerloop (+ 1 k)))))))))
%o (define (A251725 n) (if (= 1 n) 1 (let ((fs (uniq (ifactor n)))) (if (= 1 (length fs)) 1 (let outerloop ((base 2)) (let innerloop ((fs fs) (prevlen #f)) (cond ((null? fs) base) ((not prevlen) (innerloop (cdr fs) (A162319bi (car fs) base))) ((= (A162319bi (car fs) base) prevlen) (innerloop (cdr fs) prevlen)) (else (outerloop (+ 1 base))))))))))
%o (Haskell)
%o import Data.List (unfoldr); import Data.Tuple (swap)
%o a251725 1 = 1
%o a251725 n = if length ps == 1 then 1 else head $ filter f [2..] where
%o f b = all (== len) lbs where len:lbs = map (length . d b) ps
%o ps = a027748_row n
%o d b = unfoldr (\z -> if z == 0 then Nothing else Just $ swap $ divMod z b)
%o -- _Reinhard Zumkeller_, Dec 17 2014
%Y Cf. A252375 (variant).
%Y Cf. A251726 (those n > 1 for which a(n) <= A006530(n)).
%Y Cf. A251727 (those n for which a(n) = A006530(n)+1).
%Y Cf. A000961 (positions of ones).
%Y Cf. A001358, A006530, A020639, A066048, A138510, A162319.
%Y Cf. A027748.
%K nonn,base
%O 1,6
%A _Antti Karttunen_, Dec 16 2014