# Definition

**_Extra perfect number_** *is the number that* **_first_** and **_last_** *bits* are **_set bits_**.

____

# Task

**_Given_**  *a positive integer*   `N` ,  **_Return_** the **_extra perfect numbers_** *in range from*  `1`  to  `N` .
____

# Warm-up (Highly recommended)

# [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers)
___

# Notes 


* **_Number_** *passed is always*  **_Positive_** .

* **_Returned array/list_** should *contain the extra perfect numbers in ascending order*  **from lowest to highest**
___

# Input >> Output Examples

```
extraPerfect(3)  ==>  return {1,3}
```
## **_Explanation_**:

# (1)10 =(1)2

**First** and **last** bits as **_set bits_**.

# (3)10 = (11)2

**First** and **last** bits as **_set bits_**.
___

```
extraPerfect(7)  ==>  return {1,3,5,7}
```

## **_Explanation_**:

# (5)10 = (101)2

**First** and **last** bits as **_set bits_**.

# (7)10 = (111)2

**First** and **last** bits as **_set bits_**.
___
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def extra_perfect(n):
	

Solutions:
def extra_perfect(n):
	return list(range(1, n + 1, 2))


def extra_perfect(n):
	return [i for i in range(n + 1) if i % 2 != 0]


def extra_perfect(n):
	return [i for i in range(1, n + 1) if bin(i)[2] == '1' and bin(i)[-1] == '1']


def extra_perfect(n):
	return [i for i in range(1, n + 1, 2)]


def extra_perfect(n):
	return [i for i in range(n + 1) if all(map(int, [bin(i)[2], bin(i)[-1]]))]


def extra_perfect(n):
	return list(filter(lambda i: bin(i)[2] == '1' and bin(i)[-1] == '1', range(n + 1)))


def extra_perfect(n):
	n = n if n % 2 != 0 else n - 1
	F = []
	i = 0
	while 2 * i + 1 <= n:
		F.append(2 * i + 1)
		i += 1
	return F