login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A107901
Length of continued fraction for prime(n)/n.
6
1, 2, 3, 3, 2, 2, 3, 4, 4, 3, 4, 2, 3, 2, 3, 3, 3, 5, 4, 5, 3, 5, 6, 5, 4, 5, 5, 6, 4, 5, 3, 4, 5, 3, 4, 3, 3, 4, 5, 3, 6, 4, 5, 6, 6, 3, 3, 7, 8, 8, 5, 5, 6, 6, 4, 6, 7, 4, 7, 5, 7, 7, 5, 4, 6, 4, 5, 5, 3, 3, 4, 3, 3, 4, 4, 3, 3, 3, 3, 4, 6, 4, 4, 4, 3, 7, 5, 5, 6, 4, 6, 5, 5, 4, 4, 5, 3, 4, 6, 7, 5, 5, 5, 4, 6
OFFSET
1,2
LINKS
Eric Weisstein's World of Mathematics, Continued Fraction.
FORMULA
a(n) = A107898(n) - 1.
EXAMPLE
From David A. Corneth, Jan 09 2024: (Start)
a(10) = 3 as prime(10)/10 = 29/10 whose continued fraction is [2; 1, 9] having length 3
a(18) = 5 as prime(18)/18 = 61/18 whose continued fraction is [3; 2, 1, 1, 3] having length 5. (End)
MATHEMATICA
A107901[n_]=Length[ContinuedFraction[Prime[n]/n]
PROG
(PARI) a(n) = #contfrac(prime(n)/n) \\ David A. Corneth, Jan 09 2024
(PARI) first(n) = my(res = primes(n)); for(i = 1, n, res[i] = #contfrac(res[i]/i)); res \\ David A. Corneth, Jan 09 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, May 26 2005
STATUS
approved