Curzon Numbers

Published by Matteo Matt in

In this challenge, establish if a given integer n is a Curzon number. If 1 plus 2 ^ n is exactly divisible by 1 plus 2 * n, then n is a Curzon number.

Given a non-negative integer n, implement a function that returns true if n is a Curzon number, or false otherwise.

Examples

is_curzon(5) ➞ true
# 1 + 2 ^ 5  = 33
# 1 + 2 * 5  = 11
# 33 is a multiple of 11

is_curzon(10) ➞ false
# 1 + 2 ^ 10  = 1025
# 1 + 2 * 10 = 21
# 1025 is not a multiple of 21

is_curzon(14) ➞ true
# 1 + 2 ^ 14  = 16385
# 1 + 2 * 14  = 29
# 16385 is a multiple of 29

Notes

  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.