Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to generate the series {1930, 1934, 1938, ..., 2014} with Mathematica. I found that I can use Sum[2014-m*4, {m, 20}] to get the sum of these numbers, so I tried Array[2014-m*4, {m, 20}], but no luck. How do I do this?

share|improve this question

closed as off-topic by Simon Woods, kale, m_goldberg, gpap, Sjoerd C. de Vries Apr 11 at 13:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Simon Woods, kale, m_goldberg, gpap, Sjoerd C. de Vries
If this question can be reworded to fit the rules in the help center, please edit the question.

Range[1930, 2014, 4] and then Total@Range[1930, 2014, 4]? –  Öskå Apr 11 at 11:38
Array does not take an iteration variable. Use it like Array[1926 + 4 # &, 22] or alternatively use Table[1926 + 4 m, {m, 22}] –  Simon Woods Apr 11 at 11:46
Your comments were helpful, got it now. If you post it as an answer and I will accept it as solution. –  kalsfbj Apr 11 at 11:54
I don't know if the question is going to be closed but I assume that you could delete it since it's clearly said in the documentation. Although, maybe @SimonWoods should reply it as a community wiki for the use of Array :) –  Öskå Apr 11 at 11:59
@Öskå, I've voted to close as RTFM but if you'd rather keep it open please feel free to combine your comment and mine into an answer. –  Simon Woods Apr 11 at 12:16

1 Answer 1

up vote 0 down vote accepted

There are several way to do this as noted in the comments:

Range[1930, 2014, 4]
Array[1926 + 4 # &, 22]
Table[1926 + 4 m, {m, 22}]

{1930, 1934, 1938, 1942, 1946, 1950, 1954, 1958, 1962, 1966, 1970, 1974, 1978, 1982, 1986, 1990, 1994, 1998, 2002, 2006, 2010, 2014}

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.