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.

A308092 The sum of the first n terms of the sequence is the concatenation of the first n bits of the sequence read as binary, with a(1) = 1.

This page as a plain text file.
%I A308092 #34 Apr 10 2021 16:34:05
%S A308092 1,2,3,7,14,28,56,112,224,448,896,1791,3583,7166,14332,28663,57326,
%T A308092 114653,229306,458612,917223,1834446,3668892,7337785,14675570,
%U A308092 29351140,58702279,117404558,234809116,469618232,939236465,1878472930,3756945860,7513891719
%N A308092 The sum of the first n terms of the sequence is the concatenation of the first n bits of the sequence read as binary, with a(1) = 1.
%C A308092 In binary, the sequence begins 1, 10, 11, 111, 1110, 11100, 111000, 1110000, 11100000, 111000000, 1110000000, 11011111111, 110111111111, 1101111111110, 11011111111100, ...
%C A308092 Conjecture: The number of 1's in the binary representation of each term is weakly increasing, i.e., A000120(a(n)) >= A000120(a(n-1)).
%C A308092 Proved by _Matthew Scroggs_; see link. - _Peter Kagey_, Jun 19 2019
%H A308092 Peter Kagey, <a href="/A308092/b308092.txt">Table of n, a(n) for n = 1..1000</a>
%H A308092 Matthew Scroggs, <a href="http://www.mscroggs.co.uk/blog/65">Number of 1s in A308092</a>
%F A308092 a(n) = c(n) - c(n-1) for n > 2, where c(n) is the concatenation of the first n bits of the sequence.
%e A308092 For n=5, 1 + 2 + 3 + 7 + 14 = 1_2 + 10_2 + 11_2 + 111_2 + 1110_2 = 11011_2, the first five bits of the sequence.
%t A308092 a[1]=1;a[2]=2;a[n_]:=a[n]=FromDigits[Flatten[IntegerDigits[#,2]&/@Table[a[k],{k,n-1}]][[;;n]],2]-Total@Table[a[m],{m,n-1}]
%t A308092 Table[a[l],{l,40}] (* _Giorgos Kalogeropoulos_, Mar 30 2021 *)
%o A308092 (Ruby)
%o A308092 def first_bits(n, seq); seq.map { |i| i.to_s(2) }.join[0...n].to_i(2) end
%o A308092 def next_term(n, seq); first_bits(n,seq) - first_bits(n-1,seq) end
%o A308092 def a308092_list(n)
%o A308092   (3..n).reduce([1,2]) { |accum, i| accum << next_term(i, accum) }
%o A308092 end
%o A308092 (Python)
%o A308092 def aupton(terms):
%o A308092   alst, bstr = [1, 2], "110"
%o A308092   for n in range(3, terms+1):
%o A308092     an = int(bstr[:n], 2) - int(bstr[:n-1], 2)
%o A308092     alst, bstr = alst + [an], bstr + bin(an)[2:]
%o A308092   return alst
%o A308092 print(aupton(34)) # _Michael S. Branicky_, Mar 30 2021
%Y A308092 Cf. A000120, A300000 (decimal analog).
%K A308092 nonn,base
%O A308092 1,2
%A A308092 _Peter Kagey_, May 12 2019