login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A215410
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, 1, 2, 5, 10, 21, 42, 85, 171, 342, 685, 1370, 2740, 5481, 10963, 21926, 43852, 87705, 175410, 350820, 701641, 1403282, 2806565, 5613131, 11226262, 22452524, 44905049, 89810098, 179620197, 359240395, 718480790, 1436961581, 2873923162, 5747846325, 11495692650
OFFSET
0,3
EXAMPLE
a(0) = 0;
a(1) = 1 because prime(3)/prime(2) > prime(2)/prime(1) -> 5/3 > 3/2 => a(1) = 2*0 + 1= 1;
a(2) = 2 because prime(4)/prime(3) < prime(3)/prime(2) -> 7/5 < 5/3 => a(2) = 2*1 + 0 = 2;
a(3) = 5 because prime(5)/prime(4) > prime(4)/prime(3) -> 11/7 > 7/5 => a(3) = 2*2 + 1 = 5.
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: A279751 A000975 A280148 * A279668 A352875 A245747
KEYWORD
nonn
AUTHOR
Michel Lagneau, Aug 09 2012
STATUS
approved