login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A123945 A version of F. K. Hwang's sequence in {3*k, 3*k+1, 3*k+2}. 1
0, 1, 1, 2, 6, 6, 5, 13, 14, 11, 27, 29, 23, 55, 60, 48, 112, 122, 97, 225, 245, 195, 451, 492, 392, 904, 986, 785, 1809, 1972, 1571, 3619, 3946, 3144, 7240, 7894, 6289, 14481, 15789, 12579, 28963, 31580, 25160, 57928, 63161, 50321, 115857, 126323, 100643, 231715, 252648, 201288 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

LINKS

G. C. Greubel, Table of n, a(n) for n = 0..1000

F. R. K. Chung, Problem 13

Donald E. Knuth, Exercise 14 (F. K. Hwang)

FORMULA

a(3*n) = floor((43/28)*2^n) - 1,

a(3*n+1) = a(3*n) + 2^(n+1),

a(3*n+2) =  floor((17/7)*2^n - 6/7).

MATHEMATICA

a[n_]:= a[n] = If[n<4, Fibonacci[n], If[Mod[n, 3]==0, Floor[(43/28)*2^(n/3)] - 1, If[Mod[n, 3]==1, a[n-1] + 2*2^((n-1)/3), Floor[(17/7)*2^(n/3) - 6/7]]]]; Table[a[n], {n, 0, 50}] (* modified by G. C. Greubel, Aug 06 2019 *)

PROG

(PARI) a(n) = if(n<4, fibonacci(n), if(n%3==0, 43*2^(n/3)\28 -1, if(n%3==1, a(n-1) + 2*2^((n-1)/3), ((17/7)*2^(n/3) -6/7)\1 ) ) );

vector(50, n, n--; a(n) ) \\ G. C. Greubel and Michel Marcus, Aug 06 2019

(MAGMA)

a:= func< n | n lt 4 select Fibonacci(n) else (n mod 3 eq 0) select Floor((43/28)*2^Floor(n/3)) - 1 else (n mod 3 eq 1) select Floor((43/28)*2^Floor((n-1)/3)) -1 +2^(Floor((n-1)/3)+1) else Floor((17/7)*2^(n/3) - 6/7) >;

[a(n): n in [0..50]]; // G. C. Greubel, Aug 06 2019

(Sage)

def a(n):

    if (n<4): return fibonacci(n)

    elif (mod(n, 3)==0): return floor((43/28)*2^floor(n/3)) - 1

    elif (mod(n, 3)==1): return a(n-1) +2*2^floor((n-1)/3)

    else: return floor((17/7)*2^(n/3) - 6/7)

[a(n) for n in (0..50)] # G. C. Greubel, Aug 06 2019

CROSSREFS

Sequence in context: A007507 A065486 A069806 * A291793 A284121 A198102

Adjacent sequences:  A123942 A123943 A123944 * A123946 A123947 A123948

KEYWORD

nonn

AUTHOR

Roger L. Bagula, Oct 25 2006

EXTENSIONS

Terms a(31) onward added by G. C. Greubel, Aug 06 2019

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 20 21:30 EDT 2019. Contains 328273 sequences. (Running on oeis4.)