OFFSET
1,1
COMMENTS
See Wikipedia link and MathWorld link for different methods of rounding half-integers.
Different from recursion a(1) = 3, a(n) = round(a(n-1)*3/2) for n > 1, which gives a(2) = 4, a(3) = 6, a(4) = 9, a(5) = 14, ... (see A147790).
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Nearest Integer Function
Wikipedia, Rounding
EXAMPLE
a(4) = round(2*(3/2)^4) = round(81/8) = round(10 + 1/8) = 10.
MATHEMATICA
Round[2(3/2)^Range[40]] (* Harvey P. Dale, Feb 04 2012 *)
PROG
(Magma) RoundToEven:=function(n); d:=Floor(n); if n-d ne 1/2 then return Round(n); else return d+(d mod 2); end if; end function; [ RoundToEven(2*(3/2)^n):n in [1..39] ]; // Klaus Brockhaus, Nov 17 2008
(PARI) {RoundToEven(n)=local(d); d=divrem(n, 1); if(d[2]<>1/2, round(n), d[1]+d[1]%2)}
{for(n=1, 39, print1(RoundToEven(2*(3/2)^n), ", "))} \\ Klaus Brockhaus, Nov 17 2008
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Nov 13 2008
EXTENSIONS
Edited by Klaus Brockhaus, Nov 17 2008
STATUS
approved