# A list of alternating interval between its components

How can I create a list of the following numbers in a table automatically?

list={3 π/10, 7 π/10, 13 π/10, 17 π/10, 23 π/10, 27 π/10, 33π/10, 37π/10,....}


I wanted to use (4n-1)π/10, but it doesn't make sense. The interval between numbers is:

(4, 6, 4, 6, ....)*π/10


Also, we can see the period which has the behavior as:

From 0 to π

[0, π],,(4n-1)π/10


and

[π, 2π],, (4n+1)π/10


etc.

• What is the list? It makes no sense as is, it is not a proper list, nor list of list, nor... – ciao Oct 8 '15 at 7:03
• Why does the pattern change between 27 and 30? The next element for the pattern would be 33 – Jason B. Oct 8 '15 at 7:19
• So Sorry, I made a mistake I just have corrected. I do apologize for my last mistake. You are right – Unbelievable Oct 8 '15 at 7:21
• "If you don't like to think"? Is FindSequenceFunction only for the non-thinkers? lol – Jason B. Oct 8 '15 at 7:27
• O, my god, Mathematica is so powerful and wonderful. – Unbelievable Oct 8 '15 at 7:30

Yet anoteher way:

Table[((Mod[n + 1, 2]*4 + 3)/10 + Floor[(n - 1)/2]) π, {n, 1, 10}]


Another, simple way:

Riffle[#, # + 4 Pi/10] &@ Table[(3+i) Pi/10, {i, 0, 30, 10} ]

π(Accumulate[Flatten[ConstantArray[{6, 4}, 10]]] - 3)/10


This will do the trick, don't know if it's the simplest, but I only recently discovered Reap and Sow so I use them all the time now

list = Reap[
iter = 3*(Pi/10);
Do[Sow[iter];
iter += If[OddQ[n], 4, 6]*(Pi/10);
, {n, 10}]][[2,1]]

(*
{(3 π)/10, (7 π)/10, (13 π)/10, (17 π)/10, (23 π)/10, (27 π)/10, (33 π)/10, (37 π)/10, (43 π)/10, (47 π)/10}
*)


Or, following Kuba's suggestion

func = FindSequenceFunction[{(3 π)/10, (7 π)/10, (13 π)/10, (17 π)/10, (23 π)/10, 27 π/10}];

(*
-(1/20) \[Pi] ((-1)^#1 + 5 (-1)^(2 #1) - 10 #1) &
*)

Table[func[x], {x, 1, 10}]


gives the same

Just for fun:

InternalInheritedBlock[{Table}, SetAttributes[Table, SequenceHold];
Table[Sequence[3 π/10 + i π, 7 π/10 + i π], {i, 0, 5}]]
(* {(3 π)/10, (7 π)/10, (13 π)/10, (17 π)/10,
(23 π)/10, (27 π)/10, (33 π)/10, (37 π)/10,
(43 π)/10, (47 π)/10, (53 π)/10, (57 π)/10} *)

f[n_] := π/10 Range[3, 10 n + 3, 10]~List~Range[7, 10 n + 7, 10] // Transpose // Flatten
`