|
|
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
|
|
|
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):
|
|
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
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|