login
Write n-th prime in binary, then increase each run of 0's by one 0, and increase each run of 1's by one 1. a(n) is the decimal equivalent of the result.
1

%I #14 Dec 07 2021 10:48:25

%S 12,7,51,15,103,115,195,199,207,243,63,1587,1635,1639,415,1843,487,

%T 499,775,783,3171,799,3271,3299,899,3635,911,3687,3699,963,255,1543,

%U 6243,6247,25395,6351,6387,6535,6543,26227,6599,26419,1663,1795,7219,1807,7367

%N Write n-th prime in binary, then increase each run of 0's by one 0, and increase each run of 1's by one 1. a(n) is the decimal equivalent of the result.

%C Apply A175046 to the primes.

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

%o (Python)

%o from sympy import prime

%o def a(n):

%o b = bin(prime(n))[2:]

%o return int(b.replace("01", "001").replace("10", "110") + b[-1], 2)

%o print([a(n) for n in range(1, 48)]) # _Michael S. Branicky_, Dec 07 2021

%Y Cf. A175046.

%Y A companion to A318923.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Sep 19 2018

%E More terms from _Rémy Sigrist_, Sep 20 2018