cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A130860 Number of decimal places of Pi given by integer approximations of the form a^(1/n).

This page as a plain text file.
%I A130860 #24 Jan 27 2022 21:59:33
%S A130860 0,0,2,2,4,2,3,4,5,5,6,6,6,6,9,9,9,10,10,11,11,13,12,13,13,14,14,14
%N A130860 Number of decimal places of Pi given by integer approximations of the form a^(1/n).
%C A130860 Approximations are rounded, not truncated; see the example for n=2. Note that this can produce anomalous results; e.g., 0.148 does not match 0.152 to 1-place accuracy, but does match it to 2-place accuracy. - _Franklin T. Adams-Watters_, Mar 29 2014
%F A130860 a(n) is the number of decimal_places in (round(Pi^n))^1/n w.r.t. Pi.
%F A130860 Note that round(Pi^n) is the sequence A002160 (Nearest integer to Pi^n).
%e A130860 a(8)=4 because 9489^(1/8) = 3.1416... is Pi accurate to 4 decimal places.
%e A130860 a(2)=0. 10^(1/2) = 3.16... rounded to one place is 3.2, while Pi to one place is 3.1.
%o A130860 (Python)
%o A130860 from math import pi, floor, ceil
%o A130860 def round(x):
%o A130860     return math.floor(x + 0.5)
%o A130860 def decimal_places(x, y):
%o A130860     dp = -1
%o A130860     # Compare integer part, shift 1 dp
%o A130860     while floor(x + 0.5) == floor(y + 0.5) and x and y:
%o A130860         x = (x - floor(x)) * 10
%o A130860         y = (y - floor(y)) * 10
%o A130860         dp = dp + 1
%o A130860     return dp
%o A130860 for n in range(1, 30):
%o A130860     pi_to_the_n = pow(pi, n)
%o A130860     pi_to_the_n_rnd = round(pi_to_the_n)
%o A130860     pi_approx = pow(pi_to_the_n_rnd, 1.0 / n)
%o A130860     dps = decimal_places(pi_approx, pi)
%o A130860     print(dps)
%Y A130860 Cf. A002160.
%K A130860 nonn,base,more
%O A130860 1,3
%A A130860 Stephen McInerney (spmcinerney(AT)hotmail.com), Jul 22 2007