%I #53 Sep 08 2022 08:46:20
%S 5,21,341,5461,1398101,22369621,5726623061,91625968981,23456248059221,
%T 96076792050570581,1537228672809129301,6296488643826193618261,
%U 1611901092819505566274901,25790417485112089060398421,6602346876188694799461995861,27043212804868893898596335048021
%N a(n) = (4^prime(n) - 1)/3.
%C 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
%H <a href="https://puzzling.stackexchange.com/questions/62647/what-number-follows-up-next-part-2">Opinions on Puzzling.StackExchange about this sequence</a>
%F a(n) = A002450(A000040(n)). - _Michel Marcus_, Mar 27 2018
%e For n = 1, the first prime number is 2, so a(1) = (4^2-1)/3 = (16-1)/3 = 15/3 = 5;
%e for n = 2, prime(2) = 3, so a(2) = (4^3-1)/3 = (64-1)/3 = 63/3 = 21;
%e for n = 5, prime(5) = 11, so a(5) = (4^(11)-1)/3 = (4194304-1)/3 = 4194303/3 = 1398101.
%t a[n_]:=(4^Prime[n] - 1)/3; Array[a, 50] (* _Stefano Spezia_, Oct 16 2018 *)
%o (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; }
%o (PARI) a(n) = (4^prime(n) - 1)/3; \\ _Michel Marcus_, Mar 27 2018
%o (Magma) [(4^NthPrime(n) - 1)/3: n in [1..20]]; // _Vincenzo Librandi_, Oct 17 2018
%Y Cf. A000040, A000120.
%Y Subsequence of A006995 and of A002450, which is a subsequence of A000975.
%Y Also the intersection of A002450 and A052294.
%K nonn,easy
%O 1,1
%A _André Dalwigk_, Mar 26 2018
|