A140407 A000225 interleaved with A000051.
1, 2, 3, 3, 7, 5, 15, 9, 31, 17, 63, 33, 127, 65, 255, 129, 511, 257, 1023, 513, 2047, 1025, 4095, 2049, 8191, 4097, 16383, 8193, 32767, 16385, 65535, 32769, 131071, 65537, 262143, 131073, 524287, 262145, 1048575, 524289, 2097151, 1048577, 4194303
Offset: 0
Keywords
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (-1,2,2).
Programs
-
Mathematica
LinearRecurrence[{-1,2,2},{1,2,3},50] (* Harvey P. Dale, Apr 03 2013 *)
-
Python
def A140407(n): return 2 if n == 1 else (1<<(n>>1))|1 if n&1 else -1^(-2<<(n>>1)) # Chai Wah Wu, Dec 21 2022
Formula
Extensions
Edited and extended by R. J. Mathar, Jul 08 2008