login
A215411
a(0) = 0; a(n+1) = 2*a(n) + k where k = 0 if prime(n+2)/prime(n+1) > prime(n+1)/prime(n), otherwise k = 1.
1
0, 0, 1, 2, 5, 10, 21, 42, 84, 169, 338, 677, 1355, 2710, 5420, 10841, 21683, 43366, 86733, 173467, 346934, 693869, 1387738, 2775476, 5550953, 11101907, 22203814, 44407629, 88815258, 177630516, 355261033, 710522066, 1421044133, 2842088266, 5684176533
OFFSET
0,4
EXAMPLE
a(0) = 0;
a(1) = 0 because prime(3)/prime(2) > prime(2)/prime(1) -> 5/3 > 3/2 => a(1) = 2*0 + 0= 0;
a(2) = 1 because prime(4)/prime(3) < prime(3)/prime(2) -> 7/5 < 5/3 => a(2) = 2*0 + 1 = 1;
a(3) = 2 because prime(5)/prime(4) > prime(4)/prime(3) -> 11/7 > 7/5 => a(3) = 2*1 + 0 = 2.
MAPLE
z0:=0: printf("%a, ", z0):for n from 1 to 40 do:p1:=ithprime(n):p2:=ithprime(n+1):p3:=ithprime(n+2):x:=evalf(p2/p1):y:=evalf(p3/p2):if y>x then k:=0:else k:=1:fi:z0:=2*z0 +k:printf("%a, ", z0):od:
CROSSREFS
Sequence in context: A030525 A116385 A267515 * A243988 A279811 A279751
KEYWORD
nonn
AUTHOR
Michel Lagneau, Aug 09 2012
STATUS
approved