Skip to main content
edited tags
Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999
added 15 characters in body
Source Link
mbomb007
  • 23.6k
  • 7
  • 66
  • 143

A positive integer N is K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation.

So, the number 1010101 is 1-sparse whereas 101101 is not.

Your task is to find the next 1-sparse number for the given input number. For example, if the input is 12 (0b1100) output should be 16 (0b10000) and if the input is 18 (0b10010) output should be 20 (0b10100).

Smallest program or function (bytesin bytes) wins! Standard loopholes disallowed.

A positive integer N is K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation.

So, the number 1010101 is 1-sparse whereas 101101 is not.

Your task is to find the next 1-sparse number for the given input number. For example, if the input is 12 (0b1100) output should be 16 (0b10000) and if the input is 18 (0b10010) output should be 20 (0b10100).

Smallest program (bytes) wins! Standard loopholes disallowed.

A positive integer N is K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation.

So, the number 1010101 is 1-sparse whereas 101101 is not.

Your task is to find the next 1-sparse number for the given input number. For example, if the input is 12 (0b1100) output should be 16 (0b10000) and if the input is 18 (0b10010) output should be 20 (0b10100).

Smallest program or function (in bytes) wins! Standard loopholes disallowed.

formatted for clarity
Source Link

A positive integer N is called KK-sparse if there are at least KK 0s between any two consecutive 1s in its binary representation. 

So, the number 1010101 is 1-sparse whereas 101101 is not. 

Your task is to find the next 1-sparse number for the given input number. For eg.example, if the input is 12 12(11000b1100) output should be 16 16(100000b10000) and if the input is 18 18(100100b10010) output should be 20 20(101000b10100).

Shortest number of bytesSmallest program (bytes) wins. Standard loopholes disallowed! Standard loopholes disallowed.

A positive integer N is called K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation. So, the number 1010101 is 1-sparse whereas 101101 is not. Your task is to find the next 1-sparse number for the given input number. For eg. if the input is 12(1100) output should be 16(10000) and if the input is 18(10010) output should be 20(10100).

Shortest number of bytes wins. Standard loopholes disallowed!

A positive integer N is K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation. 

So, the number 1010101 is 1-sparse whereas 101101 is not. 

Your task is to find the next 1-sparse number for the given input number. For example, if the input is 12 (0b1100) output should be 16 (0b10000) and if the input is 18 (0b10010) output should be 20 (0b10100).

Smallest program (bytes) wins! Standard loopholes disallowed.

Tweeted twitter.com/#!/StackCodeGolf/status/583584218518806528
edited tags
Link
user3094403
  • 8.4k
  • 7
  • 46
  • 71
Loading
Source Link
articuno
  • 411
  • 4
  • 5
Loading