[go: up one dir, main page]

login
Search: a055254 -id:a055254
     Sort: relevance | references | number | modified | created      Format: long | short | data
Number of digits in 2^n.
+0
24
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
OFFSET
0,5
COMMENTS
The sequence consists of the positive integers, each appearing 3 or 4 times. - M. F. Hasler, Oct 08 2016
LINKS
Eric Weisstein's World of Mathematics, Mersenne Number
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
a(n) = A055642(2^n) = A055642(A000079(n)).
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 *)
IntegerLength[2^Range[0, 80]] (* Harvey P. Dale, Jul 28 2017 *)
PROG
(Magma) [#Intseq(2^n): n in [0..100] ]; // Vincenzo Librandi, Jun 23 2015
(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))
print([a(n) for n in range(73)]) # Michael S. Branicky, Dec 23 2022
CROSSREFS
See A125117 for the sequence of first differences.
KEYWORD
nonn,base,easy
STATUS
approved
Number of even digits in 2^n.
+0
5
0, 1, 1, 1, 1, 1, 2, 2, 2, 1, 3, 4, 3, 2, 3, 3, 2, 2, 5, 5, 4, 3, 4, 6, 3, 3, 6, 4, 6, 4, 5, 7, 6, 4, 4, 4, 5, 4, 7, 5, 4, 5, 7, 9, 8, 8, 8, 7, 8, 6, 10, 8, 7, 7, 9, 9, 6, 8, 8, 11, 11, 9, 12, 10, 10, 10, 13, 9, 8, 8, 10, 16, 15, 10, 13, 8, 7, 12, 12, 14, 13, 12, 15, 11, 12, 14, 10, 14, 16, 14, 16
OFFSET
0,7
LINKS
MAPLE
A055253 := 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 = 0 then j := j+1 fi; n := floor(n/10); od; RETURN(j); end: seq(A055253(n), n=0..110); # Jaap Spies, Dec 30 2003
MATHEMATICA
Table[Length@ Select[IntegerDigits[2^n], EvenQ], {n, 0, 120}] (* or *)
Table[Total@ Pick[DigitCount[2^n], {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, 1], {n, 0, 120}] (* Michael De Vlieger, May 01 2016 *)
Count[IntegerDigits[#], _?EvenQ]&/@(2^Range[0, 100]) (* Harvey P. Dale, Mar 25 2020 *)
PROG
(PARI) a(n) = #select(x->(x % 2) == 0, digits(2^n)); \\ Michel Marcus, May 01 2016
(Python)
def a(n): return sum(1 for d in str(1<<n) if d in "02468")
print([a(n) for n in range(91)]) # Michael S. Branicky, Dec 23 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Asher Auel, May 05 2000
EXTENSIONS
More terms from Jaap Spies, Dec 30 2003
STATUS
approved
Difference between the number of odd and even digits in the decimal expansion of 2^n.
+0
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
OFFSET
0,7
COMMENTS
All vanishing entries are a(A272898(k)) = 0, k >= 1. - Wolfdieter Lang, May 24 2016
LINKS
FORMULA
a(n) = A055254(n) - A055253(n) = A196564(2^n) - A196563(2^n). - Indranil Ghosh, Mar 13 2017
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));
for(n=0, 78, print1(a(n), ", ")) \\ Indranil Ghosh, Mar 13 2017
(Python)
def A272896(n):
....x=y=0
....for i in str(2**n):
........if int(i)%2: x+=1
........else: y+=1
....return x - y # Indranil Ghosh, Mar 13 2017
KEYWORD
sign,base
AUTHOR
Seiichi Manyama, May 09 2016
STATUS
approved

Search completed in 0.008 seconds