login
a(n) = prime(n+1) mod (2^k) where k is the least positive integer such that floor(prime(n)/(2^k)) = floor(prime(n+1)/(2^k)) and prime(n) denotes the n-th prime number.
2

%I #9 Jun 02 2020 14:09:43

%S 1,5,3,11,5,17,3,7,13,3,37,9,3,7,21,11,5,67,7,9,7,19,9,33,5,3,11,5,17,

%T 15,131,9,3,21,3,13,35,7,13,19,5,15,65,5,3,19,15,35,5,9,7,17,11,257,7,

%U 13,3,21,9,3,37,19,7,9,5,75,17,11,5,33,7,15,21,11

%N a(n) = prime(n+1) mod (2^k) where k is the least positive integer such that floor(prime(n)/(2^k)) = floor(prime(n+1)/(2^k)) and prime(n) denotes the n-th prime number.

%C In other words, the binary representation of a(n) is the smallest suffix to be overlaid on the binary representation of the n-th prime number to obtain that of the next prime number.

%C This sequence has similarities with A006519; here we consider consecutive prime numbers, there consecutive nonnegative integers.

%C There are no two consecutive equal terms.

%H Rémy Sigrist, <a href="/A335302/b335302.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) <= prime(n+1) with equality iff prime(n+1) belongs to A014210.

%e The first terms, alongside the binary representations of a(n) and of prime(n+1), are:

%e n a(n) bin(a(n)) bin(prime(n+1))

%e -- ---- --------- ---------------

%e 0 N/A N/A 10

%e 1 1 1 11

%e 2 5 101 101

%e 3 3 11 111

%e 4 11 1011 1011

%e 5 5 101 1101

%e 6 17 10001 10001

%e 7 3 11 10011

%e 8 7 111 10111

%e 9 13 1101 11101

%e 10 3 11 11111

%o (PARI) { base=2; p=2; forprime (q=p+1, 379, for (k=0, oo, m=base^k; if (q\m == p\m, print1 (q%m", "); p=q; break))) }

%Y Cf. A006519, A014210, A335301 (decimal variant).

%K nonn,base

%O 1,2

%A _Rémy Sigrist_, May 31 2020