Your task is to ___find the next higher number (int) with same '1'- Bits___.

I.e. as much `1` bits as before and output next higher than input. Input is always an int in between 1 and 1<<30 (inclusive). No bad cases or special tricks... 

### Some easy examples:

```
Input: 129  => Output: 130 (10000001 => 10000010)
Input: 127 => Output: 191 (01111111 => 10111111)
Input: 1 => Output: 2 (01 => 10)
Input: 323423 => Output: 323439 (1001110111101011111 => 1001110111101101111)
```

First some static tests, later on many random tests too;-)!

### Hope you have fun! :-)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def next_higher(value):
	

Solutions:
def next_higher(value):
	s = f'0{value:b}'
	i = s.rfind('01')
	s = s[:i] + '10' + ''.join(sorted(s[i + 2:]))
	return int(s, 2)


from itertools import count

def next_higher(value):
	bits = bin(value).count('1')
	return next((i for i in count(value + 1) if bin(i).count('1') == bits))


import re

def next_higher(v):
	return int(re.sub('(0?1)(1*)(0*)$', '10\\3\\2', f'{v:b}'), 2)


from math import log2

def next_higher(v):
	l = v & -v
	u = ~(v | l - 1) & -~(v | l - 1)
	return (v | u - 1) ^ u - 1 | u | (v & u - 1) >> int(log2(l)) + 1


next_higher = lambda x: x + (x & -x) | (x ^ x + (x & -x)) // (x & -x) >> 2


from collections import Counter

def next_higher(prev: int) -> int:
	bin_string = f'0{prev:b}'
	i = bin_string.rfind('01')
	counts = Counter(bin_string[i + 2:])
	return int(f"{bin_string[:i]}10{'0' * counts['0']}{'1' * counts['1']}", 2)


def next_higher(value):
	value = list(bin(value)[2:][-1::-1])
	one = value.count('1')
	while True:
		tale = 1
		for i in range(len(value)):
			bite = str((int(value[i]) + tale) % 2)
			value[i] = bite
			tale = 1 if bite == '0' else 0
			if not tale:
				break
		if tale:
			value.append('1')
		if value.count('1') == one:
			break
	return int(''.join(value[-1::-1]), 2)


def next_higher(n):
	b = f'0{n:b}'
	i = b.rfind('01')
	return int(f"{b[:i]}10{''.join(sorted(b[i + 2:]))}", 2)


def next_higher(value):
	c = bin(value).count('1')
	output_num = ''
	while True:
		value = value + 1
		if c == bin(value).count('1'):
			output_num = value
			break
	return output_num


def next_higher(value):
	value2 = value + 1
	while bin(value).count('1') != bin(value2).count('1'):
		value2 += 1
	return value2