Given n, your output should be a vector y of numbers such that the first number is 1 and the numbers following it alternate between 0 and 1. Thus,
if n = 10, then y = [1 0 1 0 1 0 1 0 1 0]
if n = 5, then y = [1 0 1 0 1]
Which values occur exactly three times?
Project Euler: Problem 7, Nth prime
07 - Common functions and indexing 6
Concatenate two strings
Get the area of the square.
Fill a zeros matrix (★★★★★)
*Prime number check 2 (in construction)
Create a vector with n repeated values of a number x (★★)
Element-wise vector product (★)
Function 1 (★)
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office