The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 24
1, 13, 221, 7069, 451997, 28931485, 1851651485, 237010810269, 60674754606493, 15532737233548701, 3976380732916495773, 1017953467644930815389, 260596087717395474544029, 66712598455657932715586973, 17078425204648505835166758301, 8744153704780027821877938484637 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(2) = 13 and a(4) = 7069 are primes. What other terms are primes? - N. J. A. Sloane, Feb 18 2023
a(38) is the next prime. - Michael S. Branicky, Feb 18 2023
LINKS
FORMULA
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))
EXAMPLE
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.
MAPLE
a:= n-> Bits[Join](map(x-> Bits[Split](x)[], [$1..n, n-i$i=1..n-1])):
seq(a(n), n=1..16); # Alois P. Heinz, Feb 18 2023
PROG
(PARI) a(n)=sum(i=1, #n=concat(vector(n*2-1, k, binary(min(k, n*2-k)))), n[i]<<(#n-i))
(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
(Python)
from itertools import count, islice
def agen(): # generator of terms
sl, sr, sk = "", "", "1"
for k in count(1):
sk = bin(k)[2:]
sl += sk
yield int(sl + sr, 2)
sr = sk + sr
print(list(islice(agen(), 16))) # Michael S. Branicky, Feb 18 2023
CROSSREFS
Cf. A359149 (binary representations).
Sequence in context: A329073 A015253 A051621 * A051180 A143832 A140841
KEYWORD
base,nonn
AUTHOR
Umut Uludag, Feb 18 2010.
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 9 14:04 EDT 2024. Contains 373243 sequences. (Running on oeis4.)