{"action":"created","issue":{"url":"https://api.github.com/repos/cplanson/think-tank/issues/8","labels_url":"https://api.github.com/repos/cplanson/think-tank/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/cplanson/think-tank/issues/8/comments","events_url":"https://api.github.com/repos/cplanson/think-tank/issues/8/events","html_url":"https://github.com/cplanson/think-tank/issues/8","id":54600904,"number":8,"title":"Perfect bits problem","user":{"login":"acadet","id":6152745,"avatar_url":"https://avatars.githubusercontent.com/u/6152745?v=3","gravatar_id":"","url":"https://api.github.com/users/acadet","html_url":"https://github.com/acadet","followers_url":"https://api.github.com/users/acadet/followers","following_url":"https://api.github.com/users/acadet/following{/other_user}","gists_url":"https://api.github.com/users/acadet/gists{/gist_id}","starred_url":"https://api.github.com/users/acadet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acadet/subscriptions","organizations_url":"https://api.github.com/users/acadet/orgs","repos_url":"https://api.github.com/users/acadet/repos","events_url":"https://api.github.com/users/acadet/events{/privacy}","received_events_url":"https://api.github.com/users/acadet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-16T17:19:58Z","updated_at":"2015-01-17T17:19:03Z","closed_at":null,"body":"Proposé par mon CTO. Je n'ai pas encore trouvé une solution viable. \r\nMatthieu va apprécier.\r\n\r\n***\r\n\r\nConsider a function `p(x)` that returns `true` if and only if the number of 1 bits in the binary representation of x is a perfect square, and `false` otherwise, eg:\r\n\r\n    p(0) # binary is \"0\", 0 1's, 0 is not a perfect square\r\n    => false\r\n\r\n    p(1) # binary is \"1\", 1 1, 1 is a perfect square\r\n    => true\r\n\r\n    p(23) # binary is \"10111\", 4 1's, 4 is a perfect square\r\n    => true\r\n\r\n    p(24) # binary is \"11000\", 2 1's, 2 is not a perfect square\r\n    => false\r\n\r\nWrite a function `perfect_bits(a, b)` (you may assume that a and b are 64-bit unsigned integers) that returns the number of integers on the range [a, b] for which p(x) would return true.\r\n\r\nFor example:\r\n\r\n    perfect_bits(1645098712823793798, 14889998042940624528)\r\n    => 1070002673201129717\r\n\r\nYou may check your solution against [http://perfect-bits.coshx.com](http://perfect-bits.coshx.com)"},"comment":{"url":"https://api.github.com/repos/cplanson/think-tank/issues/comments/70375041","html_url":"https://github.com/cplanson/think-tank/issues/8#issuecomment-70375041","issue_url":"https://api.github.com/repos/cplanson/think-tank/issues/8","id":70375041,"user":{"login":"FoxCie","id":6329725,"avatar_url":"https://avatars.githubusercontent.com/u/6329725?v=3","gravatar_id":"","url":"https://api.github.com/users/FoxCie","html_url":"https://github.com/FoxCie","followers_url":"https://api.github.com/users/FoxCie/followers","following_url":"https://api.github.com/users/FoxCie/following{/other_user}","gists_url":"https://api.github.com/users/FoxCie/gists{/gist_id}","starred_url":"https://api.github.com/users/FoxCie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoxCie/subscriptions","organizations_url":"https://api.github.com/users/FoxCie/orgs","repos_url":"https://api.github.com/users/FoxCie/repos","events_url":"https://api.github.com/users/FoxCie/events{/privacy}","received_events_url":"https://api.github.com/users/FoxCie/received_events","type":"User","site_admin":false},"created_at":"2015-01-17T17:19:03Z","updated_at":"2015-01-17T17:19:03Z","body":"J'ai trouvé une solution, mais l'implémentation ne fonctionne pas pour des (très) grands nombres, je soupçonne un overflow quelque part, peut-être dans le calcul des combinaisons. Si tu veux ma solution, dis le moi."}}