0

More specifically ,suppose the vector [(0.1^36)(0.2^34)(0.2^33)(0.4^31),...,(204.8^3)(409.6^1)] where the x in the title in this case is 36 Im assuming that something such as seq meaning the geometric series plays a role but i cant figure out how to write the the code so that there is a "pause" every one number and how to create the sequence for the exponents

I tried creating a sequence for the exponents so that their value decreases as the base number grows but i couldnt

  • You can create two vector, but I did not undertand what are the rules for x and and exponents – Vinícius Félix Nov 24 '22 at 16:44
  • for example lets say the way the base numbers progress is as such : 1 2 2 4 8 8 16 32 32 ... and the exponents for each according base number go as such : 36 34 33 31 30 28 27 so the exponents are decreased by intervals of 2 then 1 then 2 again. also i need a to make a single vector that produces the sequence in question – Petros Xristodoulou Nov 24 '22 at 17:13
  • Welcome to SO. Please read this page explaining [how to create a Minimal Reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Could you share what code you have tried since now? – Scipione Sarlo Nov 24 '22 at 18:44

1 Answers1

0
n <- 12
 
aux1 <- rep(c(1,2),n)
aux1
 [1] 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2

e <- rev(cumsum(aux1))
e
 [1] 36 34 33 31 30 28 27 25 24 22 21 19 18 16 15 13 12 10  9  7  6  4  3  1

aux2 <- sort(c(seq(0,n,1),seq(1,n,2)))
aux2
 [1]  0  1  1  2  3  3  4  5  5  6  7  7  8  9  9 10 11 11 12     

m <- 2**aux2
m
 [1]    1    2    2    4    8    8   16   32   32   64  128  128  256  512  512 1024 2048 2048 4096
Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32