OFFSET
1,1
COMMENTS
"The prime maze - consider the prime numbers in base 2, starting with the smallest prime (10)2. One can move to another prime number by either changing only one digit of the number, or adding a 1 to the front of the number. Can we reach 11 = (1011)2.? 333? The Mersennes?" - Caldwell
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Chris K. Caldwell, Prime Links + +
W. Paulsen, The Prime Maze, Fib. Quart., 40 (2002), 272-279.
EXAMPLE
47 is in the sequence because 47d = 101111b which has five 1's in its binary notation; an odd number. Also 47 == 2 (mod 3); an even number. Therefore a mismatch exists.
MAPLE
filter:= proc(n) convert(convert(n, base, 2), `+`) + (n mod 3) mod 2 = 1 end proc:
select(filter, [seq(ithprime(i), i=2..1000)]); # Robert Israel, Jun 19 2018
MATHEMATICA
Select[ Range[3, 1000, 2], PrimeQ[ # ] && EvenQ[ Count[ IntegerDigits[ #, 2], 1]] == OddQ[ Mod[ #, 3]] & ]
PROG
(PARI) isok(p) = (p>2) && isprime(p) && ((hammingweight(p) % 2) != ((p % 3) % 2)); \\ Michel Marcus, Dec 15 2018
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Nov 06 2001
STATUS
approved