Not an ordinary list of numbers

I’m trying to generate a list of numbers, but the numbers musn’t follow up each other.
I hope the images below can explain what I mean. Lets say I want to print 180 tickets, numbering from 1 to 180. I can print 6 numbered tickets on a single sheet of paper, so I would need 30 sheets.
I want applescript to generate a list so that if I cut the stack, I get six stacks numbering from 1 to 30, 31 to 60 …
But the number of tickets can be a variable as the number of tickets on a sheet as well.

This is my beginning of the script but I have no figure how to accomplish my idea

``````
set firstNumber to text returned of (display dialog "starting number" default answer "")
set finalNumber to text returned of (display dialog "ending number" default answer "")
--set quantityTickets to text returned of (display dialog "number of tickets" default answer "")
--set ticketsPerPrint to text returned of (display dialog "number of tickets on a single sheet of paper" default answer "")

set myList to {}
repeat with x from firstNumber to finalNumber
set end of myList to x
end repeat
myList

``````

Hi,

a very very simple algorithm, it doesn’t consider any special cases

``````
set firstNumber to "1" as integer -- text returned of (display dialog "starting number" default answer "")
set finalNumber to "180" as integer -- text returned of (display dialog "ending number" default answer "")
-- set quantityTickets to text returned of (display dialog "number of tickets" default answer "")
set ticketsPerPrint to "6" as integer -- text returned of (display dialog "number of tickets on a single sheet of paper" default answer "")

set pagesToPrint to ((finalNumber - firstNumber + 1) / ticketsPerPrint) div 1
set myList to {}
repeat with x from 1 to pagesToPrint
set secondList to {}
repeat with y from 0 to ticketsPerPrint - 1
set end of secondList to pagesToPrint * y + x
end repeat
set end of myList to secondList
end repeat
myList

``````

thx, that worked for me.
Only had to round up the result of the division, else I don’t get enough numbers