# Am I a Cullen Number?

A Cullen Number is any number that is contained in the sequence generated using the formula:

C(n) = (n*2^n)+1.

Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a Cullen Number.

## Input:

A non-negative integer between 0 and 10^9 (inclusive).

## Output:

A truthy/falsy value that indicates whether the input is a Cullen Number.

## Test Cases:

Input:    Output:
1   --->  truthy
3   --->  truthy
5   --->  falsy
9   --->  truthy
12  --->  falsy
25  --->  truthy


## Scoring:

This is , so the lowest score in bytes wins.

• What's the range of n? In particular, is 1 a Cullen Number?
– user62131
Commented Jun 17, 2017 at 20:15
• @ais523 according to OEIS, it is. n seems to be 0-based. Commented Jun 17, 2017 at 20:25
• Fair enough. Just needed to know whether my Jelly answer should have an Ḷ or R in it :-)
– user62131
Commented Jun 17, 2017 at 20:25
• Related Commented Jun 17, 2017 at 20:36
• Umm, what's with the downvote? Commented Jun 20, 2017 at 13:47

# QBIC, 24 bytes

[0,:|~a*(2^a)+1=b|_Xq}?0


## Explanation

[0,:|           FOR a = 0 to b (input from cmd line)
~a*(2^a)+1=b    IF calculating this a results in b
|_Xq            THEN quit, printing 1
}               NEXT a
?0              We haven't quit early, so print 0 and end.


# k, 19 bytes

{&1=x-{x**/x#2}'!x}


Try it online. Truthy is an array with a number in it: ,3 or ,0 et cetera. Falsey is an empty array: () or !0 depending on your interpreter.

# Java (OpenJDK 8), 56 bytes

i->{int n,c;for(n=0;(c=n*(2<<n++-1)+1)<i;);return c==i;}


Try it online!

# Pari/GP, 25 bytes

n->!prod(i=0,n,n-i*2^i-1)


Try it online!

# Thunno 2-c, 5 bytes

ĖıỴ;Ƈ


Try it online!

## Thunno 2, 6 bytes

ĖDO×⁺Ƈ


Try it online!

#### Explanation

ĖıỴ;Ƈ  # Implicit input
# Decrement the input
Ė      # Push [0..input-1]
Ỵ    # Left bit-shift each
ı ;   # number by itself
Ƈ  # Is (input - 1)
# in this list?
# Implicit output

ĖDO×⁺Ƈ  # Implicit input
Ė       # Push [0..input]
D      # Duplicate it
O     # Push 2 ** that
×    # Multiply together
⁺   # Increment each
Ƈ  # Is the input
# in this list?
# Implicit output