Ant-Contrib's accepts any type which exposes an iterator()
method I believe, so you'd have to write a Java task or to
create such an type.
You could also try a recursive or (with proper
stopping condition ;-) that writes the numbers to a file, and then
it.
Using a little