Displaying 1-4 of 4 results found.
page
1
1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22
COMMENTS
The sequence consists of the positive integers, each appearing 3 or 4 times. - M. F. Hasler, Oct 08 2016
FORMULA
a(n) = floor(n*log_10(2)) + 1. E.g., a(10)=4 because 2^10 = 1024 and floor(10*log_10(2)) + 1 = 3 + 1 = 4. - Jaap Spies, Dec 11 2003
MAPLE
seq(floor(n*ln(2)/ln(10))+1, n=0..100); # Jaap Spies, Dec 11 2003
MATHEMATICA
Table[Length[IntegerDigits[2^n]], {n, 0, 100}] (* T. D. Noe, Feb 11 2013 *)
PROG
(PARI) A034887(n)=n*log(2)\log(10)+1 \\ or: { a(n)=#digits(1<<n) }. - M. F. Hasler, Oct 08 2016
(Python)
def a(n): return len(str(1 << n))
CROSSREFS
See A125117 for the sequence of first differences.
Number of odd digits in 2^n.
+10
4
1, 0, 0, 0, 1, 1, 0, 1, 1, 2, 1, 0, 1, 2, 2, 2, 3, 4, 1, 1, 3, 4, 3, 1, 5, 5, 2, 5, 3, 5, 5, 3, 4, 6, 7, 7, 6, 8, 5, 7, 9, 8, 6, 4, 6, 6, 6, 8, 7, 9, 6, 8, 9, 9, 8, 8, 11, 10, 10, 7, 8, 10, 7, 9, 10, 10, 7, 12, 13, 13, 12, 6, 7, 12, 10, 15, 16, 12, 12, 10, 12, 13, 10, 14, 14, 12, 16, 13, 11, 13, 12
COMMENTS
Related sequence b(n) = Number of digits in 2^n that are at least 5. a(0) = 1, b(0) = 0 and a(n+1) = b(n), as a digit with value 5 of higher in 2^n will generate an odd digit in 2^(n+1). In the Nieuw Archief voor Wiskunde link there is a proof that sum(k>=, b(k)/2^k) = 2/9. - Jaap Spies, Mar 13 2009
REFERENCES
J. Borwein, D. Bailey and R. Girgensohn, Experimentation in mathematics : computational paths to discovery, A. K. Peters, 2004, pp. 14-15.
FORMULA
Sum(k>=0,a(k)/2^k)=11/9 (for a proof see the comment above). [Corrected by Jaap Spies, Mar 13 2009]
EXAMPLE
2^30 = 1073741824 and 1073741824 contains 5 odd decimal digits hence a(30)=5.
MAPLE
A055254 := proc(val) local i, j, k, n; n := 2^val; j := 0; k := floor(ln(n)/ln(10))+1; for i from 1 to k do if (n mod 10) mod 2 = 1 then j := j+1 fi; n := floor(n/10); od; RETURN(j); end: seq( A055254(n), n=0..110); # Jaap Spies
MATHEMATICA
A055254[N_] := Count[ #, True] & /@ Map[OddQ, IntegerDigits /@ (2^# & /@ Range[N])] (* This generates a table of the number of odd digits in the first N powers of two *) (* Douglas Skinner (skinnerd(AT)comcast.net), Dec 06 2007 *)
Table[Count[IntegerDigits[2^n], _?OddQ], {n, 0, 90}] (* Harvey P. Dale, Mar 25 2015 *)
PROG
(Perl) sub a{my $m; map $m+=1&$_, split //, 1<<pop; $m}
(Python)
def a(n): return sum(1 for d in str(1<<n) if d in "13579")
Difference between the number of odd and even digits in the decimal expansion of 2^n.
+10
1
1, -1, -1, -1, 0, 0, -2, -1, -1, 1, -2, -4, -2, 0, -1, -1, 1, 2, -4, -4, -1, 1, -1, -5, 2, 2, -4, 1, -3, 1, 0, -4, -2, 2, 3, 3, 1, 4, -2, 2, 5, 3, -1, -5, -2, -2, -2, 1, -1, 3, -4, 0, 2, 2, -1, -1, 5, 2, 2, -4, -3, 1, -5, -1, 0, 0, -6, 3, 5, 5, 2, -10, -8, 2, -3, 7, 9, 0, 0
EXAMPLE
2^10 = 1024, 2^11 = 2048, 2^12 = 4096, 2^13 = 8192.
So a(10) = 1 - 3 = -2, a(11) = 0 - 4 = -4, a(12) = 1 - 3 = -2, a(13) = 2 - 2 = 0.
MATHEMATICA
Table[Count[#, _?OddQ] - Count[#, _?EvenQ] &@ IntegerDigits[2^n], {n, 0, 100}] (* Michael De Vlieger, May 09 2016 *)
PROG
(Ruby)
def a(n)
str = (2 ** n).to_s
str.size - str.split('').map(&:to_i).select{|i| i % 2 == 0}.size * 2
end
(0..n).each{|i| p a(i)}
(PARI) a(n) = #select(x -> x%2, digits(2^n)) - #select(x -> !(x%2), digits(2^n));
(Python)
....x=y=0
....for i in str(2**n):
........if int(i)%2: x+=1
........else: y+=1
Decimal expansion of Sum_{n>=1} f(2^n)/2^n, where f(n) is the number of even digits in n.
+10
0
1, 0, 3, 1, 6, 0, 6, 3, 8, 6, 4, 4, 5, 0, 9, 6, 1, 2, 2, 5, 1, 5, 4, 7, 7, 3, 5, 4, 1, 8, 7, 1, 3, 0, 3, 1, 0, 3, 9, 0, 2, 2, 6, 4, 1, 5, 2, 9, 2, 6, 9, 4, 0, 7, 0, 9, 5, 7, 6, 7, 3, 2, 4, 1, 2, 1, 1, 1, 0, 7, 2, 8, 3, 9, 2, 1, 4, 0, 7, 8, 9, 1, 6, 0, 5, 5, 6, 1, 7, 2, 3, 7, 5, 1, 1, 2, 0, 6, 8, 2, 4, 0, 0, 2, 5, 5
COMMENTS
This constant is transcendental. If the number of even digits is replaced with the number of odd digits, then the sum will be 1/9. (Borwein et al. 2004). - Amiram Eldar, Nov 14 2020
REFERENCES
Jonathan Borwein, David Bailey and Roland Girgensohn, Experimentation in Mathematics: Computational Paths to Discovery, A K Peters, 2004, pp. 14-15.
FORMULA
Equals -1/9 + Sum_{k>=1} (1 + floor(k * log_10(2)))/2^k. - Amiram Eldar, Nov 14 2020
MATHEMATICA
RealDigits[-1/9 + Sum[(1 + Floor[k*Log10[2]])/2^k, {k, 1, 350}], 10,
PROG
(PARI) -1/9 + suminf(k=1, (1 + floor(k * log(2)/log(10)))/2^k) \\ Michel Marcus, Nov 14 2020
Search completed in 0.008 seconds
|