Skip to main content
2 of 4
added 262 characters in body
randomra
  • 20.9k
  • 4
  • 46
  • 111

J, 14 chars

This is just hardcoding the [1,2, 4+3*k (k=0..n) ] sequence and takes the first N.

   ({.1,2,4+3*i.) 10
1 2 4 7 10 13 16 19 22 25

. J, 18 chars

This one uses the linear combination of [0,1,2,3...], [1,1,0,0...] and [0,1,1,1...]. Should be shorter but can't seem to golf it.

   ((3&*+<&2-2**)@i.) 10
1 2 4 7 10 13 16 19 22 25
randomra
  • 20.9k
  • 4
  • 46
  • 111