|
|
A080457
|
|
a(1)=3; for n>1, a(n)=a(n-1) if n is already in the sequence, a(n)=a(n-1)+4 otherwise.
|
|
6
|
|
|
3, 7, 7, 11, 15, 19, 19, 23, 27, 31, 31, 35, 39, 43, 43, 47, 51, 55, 55, 59, 63, 67, 67, 71, 75, 79, 79, 83, 87, 91, 91, 95, 99, 103, 103, 107, 111, 115, 115, 119, 123, 127, 127, 131, 135, 139, 139, 143, 147, 151, 151, 155, 159, 163, 163, 167, 171, 175
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 3 + 4*(n-2-floor((n-3)/4)).
G.f.: x*(3+4*x+4*x^3+x^4)/((x-1)^2*(1+x+x^2+x^3)).
a(n) = a(n-1)+a(n-4)-a(n-5), n>5.
a(n) = (6*n-1+(-1)^n-2*(-1)^((2*n+1-(-1)^n)/4))/2. (End)
|
|
MAPLE
|
|
|
MATHEMATICA
|
CoefficientList[Series[(3 + 4 x + 4 x^3 + x^4)/((x - 1)^2*(1 + x + x^2 + x^3)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Jul 15 2015 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {3, 7, 7, 11, 15}, 70] (* Vincenzo Librandi, Jul 16 2015 *)
|
|
PROG
|
(Magma) [3+4*(n-2-Floor((n-3)/4)) : n in [1..100]]; // Wesley Ivan Hurt, Jul 15 2015
(PARI) main(size)={my(v=vector(size), i, j); v[1]=3; for(j=2, size, x=0; for(i=1, j-1, if(v[i]==j, x=1; break)); if(x==1, v[j]=v[j-1], v[j]=v[j-1]+4)); return(v); } /* Anders Hellström, Jul 15 2015 */
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|