|
|
A301797
|
|
a(n) = (4^prime(n) - 1)/3.
|
|
0
|
|
|
5, 21, 341, 5461, 1398101, 22369621, 5726623061, 91625968981, 23456248059221, 96076792050570581, 1537228672809129301, 6296488643826193618261, 1611901092819505566274901, 25790417485112089060398421, 6602346876188694799461995861, 27043212804868893898596335048021
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Also, numbers with a prime number of bits 1 (cf. A001348), interleaved with bits 0. Or: odd numbers with alternating binary digits and a prime Hamming weight A000120, cf. A052294. - M. F. Hasler, Oct 16 2018
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
For n = 1, the first prime number is 2, so a(1) = (4^2-1)/3 = (16-1)/3 = 15/3 = 5;
for n = 2, prime(2) = 3, so a(2) = (4^3-1)/3 = (64-1)/3 = 63/3 = 21;
for n = 5, prime(5) = 11, so a(5) = (4^(11)-1)/3 = (4194304-1)/3 = 4194303/3 = 1398101.
|
|
MATHEMATICA
|
a[n_]:=(4^Prime[n] - 1)/3; Array[a, 50] (* Stefano Spezia, Oct 16 2018 *)
|
|
PROG
|
(Java) public static int a(int n){ int p = 1; while(n > 0){ p++; if(!new String(new char[p]).matches("(..+?)\\1+|.?")){ n--; } } return ((int) Math.pow(4, p)-1)/3; }
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|