cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A322849 Number of times 2^k (for k < 4) appears as a substring within 2^n.

This page as a plain text file.
%I A322849 #29 Feb 11 2019 19:47:30
%S A322849 1,1,1,1,1,1,1,3,1,2,3,3,1,3,3,2,0,3,5,5,3,3,4,4,3,3,4,6,4,3,6,7,4,4,
%T A322849 6,3,3,5,5,6,4,5,7,5,8,8,5,7,6,7,9,9,3,5,10,5,3,11,10,7,8,6,10,7,8,11,
%U A322849 8,9,8,7,12,15,10,8,13,7,8,15,8,9,12,14,12,6,13
%N A322849 Number of times 2^k (for k < 4) appears as a substring within 2^n.
%C A322849 It appears that the only 0 in this sequence is a(16).
%F A322849 a(n) <= A322850(n), for n >= 4.
%F A322849 a(n) = A065712(n) + A065710(n) + A065715(n) + A065719(n). - _Michel Marcus_, Dec 30 2018
%e A322849 n =  0, a(n) = 1, 2^n =     1 - solution is 1;
%e A322849 n =  1, a(n) = 1, 2^n =     2 - solution is 2;
%e A322849 n =  2, a(n) = 1, 2^n =     4 - solution is 4;
%e A322849 n =  3, a(n) = 1, 2^n =     8 - solution is 8;
%e A322849 n =  4, a(n) = 1, 2^n =    16 - solution is 1;
%e A322849 n =  5, a(n) = 1, 2^n =    32 - solution is 2;
%e A322849 n =  6, a(n) = 1, 2^n =    64 - solution is 4;
%e A322849 n =  7, a(n) = 3, 2^n =   128 - solutions are 1,2,8;
%e A322849 n = 14, a(n) = 3, 2^n = 16384 - solutions are 1,4,8;
%e A322849 n = 15, a(n) = 2, 2^n = 32768 - solutions are 2,8;
%e A322849 n = 16, a(n) = 0, 2^n = 65536 - no solutions.
%t A322849 Array[Total@ DigitCount[2^#, 10, {1, 2, 4, 8}] &, 85, 0] (* _Michael De Vlieger_, Dec 31 2018 *)
%o A322849 (Python 3.7)
%o A322849 import re
%o A322849 results = []
%o A322849 start_n = 0
%o A322849 N = 100
%o A322849 current_num = int(pow(2, start_n-1))    # Calculate (n-1) power. Convert to integer for better precision
%o A322849 for n in range(start_n, N):
%o A322849     if n == 0:
%o A322849         current_num = 1
%o A322849     else:
%o A322849         current_num += current_num
%o A322849     count = 0
%o A322849     for test_str in ["1", "2", "4", "8"]:
%o A322849         count += len(re.findall(test_str,  str(current_num)))
%o A322849     results.append(count)
%o A322849 print(results)
%o A322849 (PARI) a(n) = #select(x->((x==1) || (x==2) || (x==4) || (x==8)), digits(2^n)); \\ _Michel Marcus_, Dec 30 2018
%Y A322849 Cf. A065712 (1), A065710 (2), A065715 (4), A065719 (8).
%Y A322849 Cf. A322849.
%K A322849 base,nonn
%O A322849 0,8
%A A322849 _Gaitz Soponski_, Dec 28 2018