|
|
A242334
|
|
Primes with property that when their binary representation is reversed we obtain a Fibonacci number.
|
|
1
|
|
|
2, 3, 5, 11, 59, 151, 317, 5441, 18427, 9033691613, 12756420479903, 1211140566276649, 401010813707734082716979, 74347828543021309956757002467819, 16538021251556158042076145869636347596983087
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
a(1) = 2 because reverse(10b) = 01b = 1 = F(1).
a(6) = 151 because reverse(10010111b) = 11101001b = 233 = F(14).
|
|
PROG
|
(Python)
import math
def is_prime(n):
....if n % 2 == 0 and n > 2:
........return False
....return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))
def dec_to_bin(x):
....return (bin(x)[2:])
fib = [1, 1]
for i in range(100):
....fib.append(fib[-1] + fib[-2])
for a in fib[3:]:
....b = dec_to_bin(a)
....c = b[::-1]
....d = int(c, 2)
....if is_prime(d) and c[0] != '0':
........print(d, c, b, a)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|