Question

Use R to identify the elements as well as their index(s) of the sequence {2^1,2^2,...,2^15} that...

Use R to identify the elements as well as their index(s) of the sequence {2^1,2^2,...,2^15} that exceed the corresponding elements of the sequence {1^3,2^3,...,15^3}. Please use Rstudio

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

seqA <-2^(1:15)

seqB <-(1:15)^3

for (i in seq(1, 15, by=1)) {

if(seqA[i]>seqB[i]){

cat("index : ",i,"\tElement : ",seqA[i],"\n")

}

}

SCREENSHOT:

# Initialize the sequence seqA <-2^(1:15) seqB <-(1:15)^3 + in #compare element wise for (i in seq(1, 15, by=1)) { if(seqA[i]
SAMPLE OUTPUT:

index: 1 Element : 2 index: 10 Element : 1024 index: 11 Element : 2048 index: 12 Element : 4096 index: 13 Element : 8192 inde

***Please upvote if it helps and feel free to comment if you have any query

Add a comment
Know the answer?
Add Answer to:
Use R to identify the elements as well as their index(s) of the sequence {2^1,2^2,...,2^15} that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT