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.

A117127 Concatenate the first n positive integers written in binary (with each integer written so the most significant 1 is on the left and the concatenated string is from left to right). a(n) is the number of times n written in binary appears in the concatenated string.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 3, 1, 2, 1, 4, 3, 4, 5, 4, 1, 2, 2, 3, 2, 3, 2, 7, 3, 4, 4, 6, 6, 5, 7, 5, 1, 2, 2, 3, 1, 4, 3, 4, 2, 4, 2, 5, 2, 4, 4, 9, 3, 4, 5, 5, 4, 6, 4, 9, 6, 6, 6, 7, 9, 6, 9, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 5, 2, 6, 4, 5, 2, 4, 3, 6, 3, 5, 4, 7, 2, 5, 4, 7, 3, 7, 5, 11, 3, 4, 5, 5, 4, 7, 5, 7, 4
Offset: 1

Views

Author

Leroy Quet, Apr 20 2006

Keywords

Comments

See also A047778, concatenation of first n numbers in binary. - Jonathan Vos Post, Apr 21 2006
Note that these counts reflect the pattern overlapping case. - Diana L. Mecum, Aug 06 2008
First occurrence of n: 1, 3, 6, 11, 14, 27, 23, 107, 47, 119, 95, 111, 191, 239, 223, 1007, 767, 447, 1535, 991, 895, 959, 3519, 1791, 1983, 1919, 3583, 7159, 7871, 3839, 14327, 16063, 8063, 7679, 7935, 15839, ??, 15359, 16127, 15871, ..., ; limit of search = 25000. - Robert G. Wilson v, Aug 30 2008

Examples

			The first 13 positive integers written in binary and concatenated is
11011100101110111100010011010101111001101.
13 in binary, which is 1101, appears 4 times in the concatenated string, starting at positions (reading from left to right) 1, 12, 25 and 38.
The last occurrence of 1101 is the integer 13 itself converted to binary and added to the end of the concatenated string, of course. So a(13) = 4.
		

Crossrefs

Programs

  • Maple
    A007088 := proc(n) convert(n,base,2) ; ListTools[Reverse](%) ; end:
    A058935 := proc(n) local i,a ; if n = 0 then RETURN([0]) ; else a := [] ; for i from 1 to n do a := [op(a),op(A007088(i))] ; od: fi ; end:
    A117127 := proc(n) local a058935,strtL,endL,nL,a ; nL := A007088(n) ; a058935 := A058935(n) ; a := 0 ; for strtL from 1 to nops(a058935) do for endL from strtL to nops(a058935) do if verify[sublist]( nL, [op(strtL..endL, a058935)] ) then a := a+1 ; fi ; od: od ; RETURN(a) ; end: for n from 1 to 80 do printf("%d, ",A117127(n)) ; od: # R. J. Mathar, Jan 23 2008
  • Mathematica
    a[n_] := StringCount[ ToString@ FromDigits@ Flatten@ IntegerDigits[ Range@n, 2], ToString@ FromDigits@ IntegerDigits[n, 2], Overlaps -> True]; Array[a, 105] (* Robert G. Wilson v, Aug 30 2008 *)
    fc[n_]:=Module[{idn2=IntegerDigits[n,2],len},len=Length[idn2];Count[ Partition[ Flatten[Table[IntegerDigits[i,2],{i,n}]],len,1],idn2]]; Array[fc,110] (* Harvey P. Dale, Dec 16 2011 *)

Extensions

More terms from R. J. Mathar, Jan 23 2008
Terms 81 through 2000 from Diana L. Mecum, Aug 06 2008