login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A334588 Distance of closest integer power of 10 to the n-th power of 2. 1
0, 1, 3, 2, 6, 22, 36, 28, 156, 412, 24, 1048, 3096, 1808, 6384, 22768, 34464, 31072, 162144, 424288, 48576, 1097152, 3194304, 1611392, 6777216, 23554432, 32891136, 34217728, 168435456, 436870912, 73741824, 1147483648, 3294967296, 1410065408, 7179869184, 24359738368 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

a(n) is a measure for how well powers of 2 may be approximated by powers of 10. It is e.g. relevant to unit conventions for the magnitude of data (e.g. 1 megabyte is approximately 1 mebibyte). The closely related sequence of distances of the closest integer power of 2 to the n-th power of 10 gives a measure for the precision of floating point expressions in computing applications.

LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..3322

Wikipedia, Floating-point arithmetic

Wikipedia, Mebibyte

EXAMPLE

For n=2, a(2) = |4-1| = 3.

For n=10, a(10) = min(|2^10-10^3|,|2^10-10^4|) = |1024-1000| = 24.

MAPLE

a:= n-> (m-> (p-> min(m-10^p, 10^(p+1)-m))(ilog10(m)))(2^n):

seq(a(n), n=0..37);  # Alois P. Heinz, May 07 2020

MATHEMATICA

A[n_] := Min[Abs[(2^n) - 10^Length[IntegerDigits[2^n]]],

  Abs[(2^n) - 10^(Length[IntegerDigits[2^n]] - 1)]]

PROG

(PARI) a(n) = my(i=logint(2^n, 10)); min(abs(10^i-2^n), abs(10*10^i-2^n)); \\ Jinyuan Wang, May 06 2020

CROSSREFS

Cf. A000079 (2^n), A011557 (10^n).

Sequence in context: A268642 A110768 A140230 * A025240 A137602 A086550

Adjacent sequences:  A334585 A334586 A334587 * A334589 A334590 A334591

KEYWORD

nonn

AUTHOR

Timon S. Gutleb, May 06 2020

EXTENSIONS

More terms from Jinyuan Wang, May 06 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 13 05:31 EDT 2021. Contains 344981 sequences. (Running on oeis4.)