<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>20bits - Latest Comments in Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.disqus.com/</link><description></description><language>en</language><lastBuildDate>Mon, 14 Jul 2008 18:09:49 -0000</lastBuildDate><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793268</link><description>There is solution to PrimeBits + Super Pattern on site &lt;a href="http://wwww.nerant.com" rel="nofollow"&gt;wwww.nerant.com&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ankur</dc:creator><pubDate>Mon, 14 Jul 2008 18:09:49 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793270</link><description>Andres,&lt;br&gt;&lt;br&gt;For powers other than 2 you need to break it down into several contiguous ranges.  You have one range more than there are ones in the binary representation of the original number.&lt;br&gt;&lt;br&gt;For example, if the number you're looking at is 10110 then the ranges are 00000-01111, 10000-10011, 10100-10101, and 10110.  There are three ones and four ranges.&lt;br&gt;&lt;br&gt;Each range corresponds to fixing one of the bits, starting from the left-most (most significant) bit.  So the first range has no fixed bits, the second has one, the third has two, etc.&lt;br&gt;&lt;br&gt;We subtract from our calculation the number of fixed bits.  So, if the range we're looking at is 10000-10011 we're interested in numbers of the form 100xx.  The only prime numbers that are suitable here are 2 and 3.  That is, we can have at most three 1-bits.&lt;br&gt;&lt;br&gt;But there's already a fixed bit (that one on the far left side), so if there are three 1-bits then that means there must be two 1-bits in the xx section.  Thus we get 2C(3-1), because we're choosing the number of combinations in the xx section such that there are three 1-bits for the &lt;em&gt;whole&lt;/em&gt; string.&lt;br&gt;&lt;br&gt;Hope that helps,&lt;br&gt;Jesse</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jesse</dc:creator><pubDate>Tue, 29 Apr 2008 13:06:39 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793269</link><description>Jesse, great job! It's an interested puzzle..&lt;br&gt;I got lost in the part of solving the problem for other numbers rather than powers of 2. Could you explain it better? Can you give me other examples? why "-1"? why starting from 2C(3-1)?&lt;br&gt;Thanks</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andres</dc:creator><pubDate>Tue, 29 Apr 2008 10:34:36 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793267</link><description>I have posted a solver, give it a try and see if our answers match: &lt;a href="http://www.ctmouton.com/projects/facebook/optimus/prime.php" rel="nofollow"&gt;http://www.ctmouton.com/projects/facebook/optim...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris</dc:creator><pubDate>Wed, 19 Dec 2007 17:05:13 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793266</link><description>I couldn't understand some parts of this article , but I guess I just need to check some more resources regarding this, because it sounds interesting.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel</dc:creator><pubDate>Tue, 14 Aug 2007 12:19:08 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793265</link><description>You wrote: "e.g., 5 is written as 101 = 1*2^2 + 0*10^1 + 1*10^0." Did you mean "e.g., 5 is written as 101 = 1*2^2 + 0*2^1 + 1*2^0."?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt</dc:creator><pubDate>Thu, 31 May 2007 17:26:14 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793257</link><description>Jesse.. my implementation was very similar.&lt;br&gt;&lt;br&gt;It took me awhile to figure out the pascal's triangle caveat, but once I figured it out it was pretty simple.&lt;br&gt;&lt;br&gt;My implementation generates the pascal array to the number of rows needed [number of significant bits].  I then 'condense' that array to create an array[x][y] that reads:&lt;br&gt;&lt;br&gt;For all numbers equal to and less than 2^[x], there are  occurances of [y] bits set on.&lt;br&gt;&lt;br&gt;From there it was as simple as adding arrays, then cross referencing them against the 'arePrimes' array.&lt;br&gt;&lt;br&gt;This was a very enjoyable problem!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sam</dc:creator><pubDate>Fri, 11 May 2007 10:10:16 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793264</link><description>Formally the binomial coefficient, nCk, is the number of k-subsets of a set of size n.  Put in laymans terms this means nCk is the number of ways you can select k balls from a bucket filled with n balls, assuming you don't care about order, i.e., you don't care if you pick the first, third, and fifth balls in that order, or the third, first, and then the fifth.&lt;br&gt;&lt;br&gt;Applying it to this problem, then, there are 6C2 6-bit numbers which have two bits set to one, 6C3 with three bits set to one, and 6C5 with five bits set to one.  Since 1, 3, and 5 are the only primes less than 6 there are 6C2 + 6C3 + 6C5 6-bit numbers with a prime number of bits set to one.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jesse</dc:creator><pubDate>Tue, 01 May 2007 02:02:59 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793263</link><description>Lost me on "binomial coefficients".</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Watch Live TV</dc:creator><pubDate>Tue, 01 May 2007 01:01:54 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793262</link><description>Well, someone looking to solve the puzzle on their own would hopefully look over this post.  If they are reading beyond the title and perhaps first paragraph, it suggests that the "fun of figuring it out for ones' self" has worn out.  ^_^</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cassie</dc:creator><pubDate>Mon, 30 Apr 2007 12:02:32 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793261</link><description>To those reading this post: I was contacted by the puzzle-writer at Facebook and he asked kindly for me to at least obscure my solution.  I'm leaving the explanation up but removing the actual implementation.  If you're interested in the implementation you can contact me and convince me I should share it with you.&lt;br&gt;&lt;br&gt;Cheers!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jesse</dc:creator><pubDate>Fri, 27 Apr 2007 23:50:20 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793260</link><description>I sent the sub-optimal solution, then I checked their puzzle page again that changed and asked for a better than O(n) solution. Then I thought about it for a while and got to the point I described. I didn't send it because I knew I could do better; I just hadn't figured it out yet.&lt;br&gt;&lt;br&gt;Then I got busy with some of my other side projects since I got an email from Facebook saying they were finished finding Summer interns (that's what I was going for). Solving the solution, while fun, would not be efficient use of my time.&lt;br&gt;&lt;br&gt;I guess the point in asking about posting the solutions is that it sort of undermines the effectiveness of the puzzle as a recruitment device. Plus it takes the fun out of figuring it out for ones' self. And by fun, I mean stress. ;)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hung</dc:creator><pubDate>Fri, 27 Apr 2007 15:43:34 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793259</link><description>Hey Hung,&lt;br&gt;&lt;br&gt;Oh, yeah?  Then did you not send anything to the Facebook?&lt;br&gt;&lt;br&gt;My intention is to solve all their interesting puzzles and post the solutions.  Why?  Well, why not?  De l'audace, encore de l'audace, toujours de l'audace.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jesse</dc:creator><pubDate>Fri, 27 Apr 2007 13:22:19 -0000</pubDate></item><item><title>Re: Facebook job puzzles: Prime bits | 20bits</title><link>http://20bits.com/articles/facebook-job-puzzles-prime-bits/#comment-3793258</link><description>Jesse, I got as far as linking the problem to the binomial coefficients and drawing some correlations to Pascal's triangle. I got stuck at the part for coming up with an algorithm for all numbers, rather than for powers of 2.&lt;br&gt;&lt;br&gt;Why would you ever post the solution? I guess you're not interested in a job at Facebook.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hung</dc:creator><pubDate>Fri, 27 Apr 2007 13:09:40 -0000</pubDate></item></channel></rss>