OFFSET
1,2
COMMENTS
The divisors can be written either from largest to smallest or from smallest to largest and the numerator of the continued fraction would remain unchanged.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
If p is prime, a(p^k) = p^k * a(p^(k-1)) + a(p^(k-2)), with a(p^0) = a(1) = 1 and a(p^1) = p+1. - Robert Israel, Jan 17 2023
EXAMPLE
The divisors of 6 are 1,2,3,6. So a(6) is the numerator of 1 +1/(2 +1/(3 +1/6)) = 63/44. a(6) is also the numerator of 6 +1/(3 +1/(2+1/1)) = 63/10.
MAPLE
f:= n -> numer(numtheory:-cfrac(sort(convert(numtheory:-divisors(n), list)))):
map(f, [$1..100]); # Robert Israel, Jan 17 2023
MATHEMATICA
f[n_] := Numerator[FromContinuedFraction[Divisors[n]]]; Table[f[n], {n, 47}] (* Ray Chandler, Jan 22 2007 *)
PROG
(PARI) a(n) = contfracpnqn(divisors(n))[1, 1]; \\ Kevin Ryde, Jan 19 2023
CROSSREFS
KEYWORD
AUTHOR
Leroy Quet, Jan 19 2007
EXTENSIONS
Extended by Ray Chandler, Jan 22 2007
STATUS
approved