cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A173427 Decimal value a(n) of the binary number b(n) obtained by starting from 1, sequentially concatenating all binary numbers up to n and then sequentially concatenating all binary numbers from n-1 down to 1.

This page as a plain text file.
%I A173427 #23 Jul 09 2025 04:32:29
%S A173427 1,13,221,7069,451997,28931485,1851651485,237010810269,60674754606493,
%T A173427 15532737233548701,3976380732916495773,1017953467644930815389,
%U A173427 260596087717395474544029,66712598455657932715586973,17078425204648505835166758301,8744153704780027821877938484637
%N A173427 Decimal value a(n) of the binary number b(n) obtained by starting from 1, sequentially concatenating all binary numbers up to n and then sequentially concatenating all binary numbers from n-1 down to 1.
%C A173427 a(2) = 13 and a(4) = 7069 are primes. What other terms are primes? - _N. J. A. Sloane_, Feb 18 2023
%C A173427 a(38) is the next prime. - _Michael S. Branicky_, Feb 18 2023
%H A173427 Amiram Eldar, <a href="/A173427/b173427.txt">Table of n, a(n) for n = 1..239</a>
%H A173427 <a href="/index/Mo#MWP">Index entries for sequences related to Most Wanted Primes video</a>
%F A173427 a(n) = binary_to_decimal(concatenate(1,10,11,..., binary(n-2), binary(n-1), binary(n), binary(n-1), binary(n-2),..., 11, 10, 1))
%e A173427 a(1)=binary_to_decimal(1)=1, a(2)=binary_to_decimal(1101)=13, a(3)=binary_to_decimal(11011101)=221, a(4)=binary_to_decimal(1101110011101)=7069 etc.
%p A173427 a:= n-> Bits[Join](map(x-> Bits[Split](x)[], [$1..n, n-i$i=1..n-1])):
%p A173427 seq(a(n), n=1..16);  # _Alois P. Heinz_, Feb 18 2023
%o A173427 (PARI) a(n)=sum(i=1,#n=concat(vector(n*2-1,k,binary(min(k, n*2-k)))),n[i]<<(#n-i))
%o A173427 (PARI) A173427(n)={my(s=0,s1=0,t=0,b=0);for(k=1,n-1,s1+=k<<t+=b; k>>b&&b++;s=s<<b+k);t+=b;n>>b&&b++;(s<<b+n)<<t+s1} \\ _M. F. Hasler_, Aug 06 2015
%o A173427 (Python)
%o A173427 from itertools import count, islice
%o A173427 def agen(): # generator of terms
%o A173427     sl, sr, sk = "", "", "1"
%o A173427     for k in count(1):
%o A173427         sk = bin(k)[2:]
%o A173427         sl += sk
%o A173427         yield int(sl + sr, 2)
%o A173427         sr = sk + sr
%o A173427 print(list(islice(agen(), 16))) # _Michael S. Branicky_, Feb 18 2023
%Y A173427 Cf. A359149 (binary representations).
%K A173427 base,nonn
%O A173427 1,2
%A A173427 _Umut Uludag_, Feb 18 2010