Ruud H.G. van Tol on Sun, 21 Jan 2024 16:34:51 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: oeis_digits( x, {D=105} ) |
On 2024-01-21 14:31, Bill Allombert wrote:
On Sun, Jan 21, 2024 at 01:54:18PM +0100, Ruud H.G. van Tol wrote:Also be aware that the used printf-format rounds to the nearest, so without proper care the final digits are easily off.You can increase your luck with this one: digreal(f,N)=localprec(N+20);digits(floor(f()*10^N)); ? digreal(()->log(2),99) %26 = [6,9,3,1,4,7,1,8,0,5,5,9,9,4,5,3,0,9,4,1,7,2,3,2,1,2,1,4,5,8,1,7,6,5,6,8,0,7,5,5,0,0,1,3,4,3,6,0,2,5,5,2,5,4,1,2,0,6,8,0,0,0,9,4,9,3,3,9,3,6,2,1,9,6,9,6,9,4,7,1,5,6,0,5,8,6,3,3,2,6,9,9,6,4,1,8,6,8,7]
Just some trivial remarks: That appears to be after Mathematica's RealDigits. https://reference.wolfram.com/language/ref/RealDigits.html ? digreal( ()->1/113, 112 ) % [8, 8, 4, 9, 5, 5, 7, 5, 2, 2, ...] is missing the 2 initial zeros. With {my( x= 1/113 ); 1 + if( x < 1, -logint(10/x, 10), logint(x, 10) )} a negative value means to prefix the zeros, and have oeis-offset-value 0. A positive value is then the "offset" itself. -- Ruud