login
a(0)=1; for n >= 1, let k = floor((1 + sqrt(8*n-7))/2), m = n - (k^2 - k+2)/2. Then a(n) = 2^k + 2^(m+1) - 1.
4

%I #23 Aug 17 2023 11:05:56

%S 1,3,5,7,9,11,15,17,19,23,31,33,35,39,47,63,65,67,71,79,95,127,129,

%T 131,135,143,159,191,255,257,259,263,271,287,319,383,511,513,515,519,

%U 527,543,575,639,767,1023,1025,1027,1031,1039,1055,1087,1151,1279,1535,2047,2049,2051,2055,2063,2079,2111,2175,2303,2559,3071

%N a(0)=1; for n >= 1, let k = floor((1 + sqrt(8*n-7))/2), m = n - (k^2 - k+2)/2. Then a(n) = 2^k + 2^(m+1) - 1.

%C The sequence is concatenation of rows of triangle which begins

%C i\j | 0 1 2 3 4 5 6 7 8

%C ======+====================================================

%C 0 | 1

%C 1 | 3 5

%C 2 | 7 9 11

%C 3 | 15 17 19 23

%C 4 | 31 33 35 39 47

%C 5 | 63 65 67 71 79 95

%C 6 | 127 129 131 135 143 159 191

%C 7 | 255 257 259 263 271 287 319 383

%C 8 | 511 513 515 519 527 543 575 639 767

%H G. C. Greubel, <a href="/A209492/b209492.txt">Table of n, a(n) for n = 0..1000</a>

%F For i=0,1,..., the i-th row is 2^(i+1)-1, if j=0, and 2^(i+1)+2^j-1, if j=1,...,i.

%e Consider n=19. Then k = floor((1 + sqrt(145))/2) = 6 and m = 19 - 16 = 3. Thus a(19) = 2^6 + 2^4 - 1 = 79.

%t k = Floor[(1 + Sqrt[8*n - 7])/2]; m = n - (k^2 - k + 2)/2; a[n_] = If[n == 0, 1, 2^k + 2^(m + 1) - 1]; Table[a[n], {n, 0, 100}]

%Y Cf. A000225, A224195 (binary reversal).

%K nonn,easy,tabl

%O 0,2

%A _Vladimir Shevelev_, Mar 09 2012