A096773 a(n) = 4*a(n-2) + 1 with a(1) = 0, a(2) = 3.
0, 3, 1, 13, 5, 53, 21, 213, 85, 853, 341, 3413, 1365, 13653, 5461, 54613, 21845, 218453, 87381, 873813, 349525, 3495253, 1398101, 13981013, 5592405, 55924053, 22369621, 223696213, 89478485, 894784853, 357913941, 3579139413, 1431655765
Offset: 1
Examples
a(1) = (2^0-1)/3 = 0, a(2) = (5*2^1 - 1) / 3 = 3, a(3) = (2^2-1)/3 = 1, a(4) = (5*2^3 - 1) / 3 = 13, a(5) = (2^4-1)/3 = 5, a(6) = (5*2^5 - 1) / 3 = 53, a(7) = (2^6-1)/3 = 21. ....
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..3323
- Index entries for sequences related to 3x+1 (or Collatz) problem
- Index entries for linear recurrences with constant coefficients, signature (1,4,-4).
Programs
-
Magma
[(2^(n-1)*(3 + 2*(-1)^n) - 1)/3: n in [1..40]]; // Vincenzo Librandi, Jul 12 2015
-
Mathematica
a[1] = 0; a[2] = 3; a[n_] := a[n] = 4a[n - 2] + 1; Table[ a[n], {n, 35}] (* Robert G. Wilson v, Aug 20 2004 *) Table[(2^(n - 1)*(3 + 2*(-1)^(n)) - 1)/3, {n, 10}] (* L. Edson Jeffery, Jul 12 2015 *) nxt[{a_,b_}]:={b,4a+1}; NestList[nxt,{0,3},40][[;;,1]] (* or *) LinearRecurrence[{1,4,-4},{0,3,1},40] (* Harvey P. Dale, Mar 19 2025 *)
-
PARI
apply( {A096773(n) = if(n%2, 1, 5)<<(n-1)\3}, [1..55]) \\ M. F. Hasler, May 28 2024
-
Perl
# To map any (odd) v to its (r,c): use bigint; $v=149; $r=$c=0; while(1){ $b=($v&1); $v>>=1; if ($b==($v&1)){ $c=($v>>1); last} $r++} $r&=1; # this splits the binary representation into two parts, at the first repeated digit from the right: the number of bits on the right is the row value, and the binary value on the left is the column value. Example: 149 => 1.00.10101 => (r,c)=(5,1). Ruud H.G. van Tol, Sep 23 2021
-
Python
A096773=lambda n:((1 if n&1 else 5)<
M. F. Hasler, May 28 2024
Formula
a(2m) = (5*2^(2m-1) - 1)/3, a(2m-1) = (2^(2m-2)-1)/3.
From Paul Curtz, Jul 01 2008; corrected by Bob Selcoe, Jul 28 2018: (Start)
a(2n) = 10*a(2n-1) + 3.
a(n+1) - 2*a(n) = A001045(n+2), signed. (End)
a(n) = (2^(n-1)*(3 + 2*(-1)^n) - 1)/3. - L. Edson Jeffery, Jul 12 2015
G.f.: -x^2*(-3+2*x) / ( (x-1)*(2*x+1)*(2*x-1) ). - R. J. Mathar, Mar 07 2017
a(2n) = (A266753(n) + A004171(n-1))/2, a(2n+1) = (A266753(n) - A004171(n-1))/2, n > 0. - Yosu Yurramendi, Mar 07 2017
a(n) = least residue 2*3^(2^(n-4)-1) - 1 (mod 2^n), n >= 5. - Bob Selcoe, Jul 26 2018
a(n) = 2*A176965(n-1) + 1 for n > 1. - Loren M. Pearson, Dec 06 2024
Comments