OFFSET
1,6
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
FORMULA
PROG
(MIT/GNU Scheme)
;; Factorization function ifactor can be found in Antti Karttunen's IntSeq-library, and code for A162319bi given in A162319:
(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)))))))))
(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))))))))))
(Haskell)
import Data.List (unfoldr); import Data.Tuple (swap)
a251725 1 = 1
a251725 n = if length ps == 1 then 1 else head $ filter f [2..] where
f b = all (== len) lbs where len:lbs = map (length . d b) ps
ps = a027748_row n
d b = unfoldr (\z -> if z == 0 then Nothing else Just $ swap $ divMod z b)
-- Reinhard Zumkeller, Dec 17 2014
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 16 2014
STATUS
approved