OFFSET
1,2
COMMENTS
The smallest prime in this sequence is 485398038695407. What is the full subsequence of primes? - N. J. A. Sloane, Oct 03 2015
There is only the one prime in the first 22400 terms, making a second prime > 10^91000. - Hans Havermann, Oct 07 2015
LINKS
Joe B. Stephen, Table of n, a(n) for n = 1..400 (terms 1..250 from Reinhard Zumkeller)
FORMULA
a(n) = a(n-1)*2^(1+floor(log_2(n))) + n. - Henry Bottomley, Jan 12 2001
a(n) = 4C / 2^frac(log_2(n)) * n^{n+1} / r(frac(log_2(n)))^n + O(1), where r(x) = 2^{x - 1 + 2^{1-x}}; frac is the fractional part function frac(x) = x - floor(x); and C is the binary Champernowne constant (A066716). (In fact, a(n) is the floor of this expression; the error term is between 1/2 and 1.) r(x) takes on values between e*log(2) and 2 for x in the range 0 to 1. It follows using Stirling's approximation that the radius of convergence for the e.g.f. is log 2. - Franklin T. Adams-Watters, Sep 07 2006
EXAMPLE
a(4) = 1 10 11 100 [base 2] = 220 [base 10].
MAPLE
conc:= (x, y) -> x*2^(1+ilog2(y))+y:
a[1]:= 1:
for n from 2 to 30 do a[n]:= conc(a[n-1], n) od:
seq(a[n], n=1..30); # Robert Israel, Oct 07 2015
MATHEMATICA
If[STARTPOINT==1, n={}, n=Flatten[IntegerDigits[Range[STARTPOINT-1], 2]]]; Table[AppendTo[n, IntegerDigits[w, 2]]; n=Flatten[n]; FromDigits[n, 2], {w, STARTPOINT, ENDPOINT}] (* Dylan Hamilton, Aug 04 2010 *)
f[n_] := FromDigits[ Flatten@ IntegerDigits[ Range@n, 2], 2]; Array[f, 18] (* Robert G. Wilson v, Nov 07 2010 *)
Module[{n = 1}, NestList[#*2^BitLength[++n] + n &, 1, 25]] (* Paolo Xausa, Sep 30 2024 *)
PROG
(Haskell)
a047778 = (foldl (\v d -> 2*v + d) 0) . concatMap (reverse . unfoldr
(\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)) .
enumFromTo 1
-- Reinhard Zumkeller, Feb 19 2012
(PARI) cb(a, b)=a<<#binary(b) + b
a(n)=fold(cb, [1..n]) \\ Charles R Greathouse IV, Jun 21 2017
(PARI) A047778_vec(N=20, s)=vector(N, k, s=s<<logint(k*2, 2)+k) \\ M. F. Hasler, Oct 25 2019
(Python)
def a(n): return int("".join([(bin(i))[2:] for i in range(1, n+1)]), 2)
print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Jan 06 2021
(Python)
from functools import reduce
def A047778(n): return reduce(lambda i, j:(i<<j.bit_length())+j, range(n+1)) # Chai Wah Wu, Feb 26 2023
CROSSREFS
KEYWORD
easy,nonn,base,nice
AUTHOR
Aaron Gulliver (gulliver(AT)elec.canterbury.ac.nz)
EXTENSIONS
More terms from Patrick De Geest, May 15 1999
Name edited by Joe B. Stephen, Jul 22 2023
STATUS
approved