Skip to main content
added 63 characters in body
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

JavaScript (ES6), 27 bytes

f=x=>x>0&&4*ff=x=>x>1&&4*f(x-1)+f(x-2)+2

Recursion to the rescue! This uses one of the formulas on the OEIS page:

f(n < 01) = 0, f(n) = 4*a(n+1)+a(n)+2

(but shifted by one because the challenge shifts it by one)

JavaScript (ES6), 27 bytes

f=x=>x>0&&4*f(x-1)+f(x-2)+2

Recursion to the rescue! This uses one of the formulas on the OEIS page:

f(n < 0) = 0, f(n) = 4*a(n+1)+a(n)+2

JavaScript (ES6), 27 bytes

f=x=>x>1&&4*f(x-1)+f(x-2)+2

Recursion to the rescue! This uses one of the formulas on the OEIS page:

f(n < 1) = 0, f(n) = 4*a(n+1)+a(n)+2

(but shifted by one because the challenge shifts it by one)

Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

JavaScript (ES6), 27 bytes

f=x=>x>0&&4*f(x-1)+f(x-2)+2

Recursion to the rescue! This uses one of the formulas on the OEIS page:

f(n < 0) = 0, f(n) = 4*a(n+1)+a(n)+2