Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Find count of binary number pattern within concatenated number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91137] Re: [mg91093] Find count of binary number pattern within concatenated number
  • From: "Adriano Pascoletti" <adriano.pascoletti at gmail.com>
  • Date: Thu, 7 Aug 2008 04:39:39 -0400 (EDT)
  • References: <200808060903.FAA22227@smc.vnet.net>

StringCount?


In[5]:= n = 13; ToString[FromDigits[Flatten[IntegerDigits[Range[n], 2]]]]
StringCount[%, "1101"]
Out[5]= "11011100101110111100010011010101111001101"
Out[6]= 4


Adriano Pascoletti

2008/8/6 Diana <diana.mecum at gmail.com>

> Math folks,
>
> Can someone tell me how to find the count of the occurrences of "1101"
> within "11011100101110111100010011010101111001101" generated with the
> FromDigits statements below? I will be increasing "n".
>
> n=13
>
> FromDigits[Flatten[IntegerDigits[Range[n],2]]]
>
> 11011100101110111100010011010101111001101.
>
> FromDigits[IntegerDigits[n, 2]]
>
> 1101
>
> Diana
>
>
>


  • Prev by Date: RE: Re: Workaround for an unexpected behavior of Sum
  • Next by Date: Re: question about sorting lists
  • Previous by thread: Find count of binary number pattern within concatenated number
  • Next by thread: RE: Find count of binary number pattern within concatenated number