All pastes #769347 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-11-11 11:12 UTC
rendered paste body
Worded Primes

Given two non-negative integers X and Y (1 < X,Y < 99,000), write a program to output all the prime numbers between them. The supplied integers, if prime, must also be listed. The output should be in words, not digits.
INPUT (Standard Input)

The first line is an integer less than 20 listing the number of testcases. The testcases are listed in the next several lines. Each testcase consists of two unequal integers, X and Y, on a line by themselves with whitespace between them, and with the smaller integer coming first.
OUTPUT (Standard Output)

For each testcase, list in increasing numerical order all the primes in the closed interval [X,Y]. The listing should be in words, for example: one hundred twenty three fifty one thousand four hundred eighty nine

Only a single space character should separate the words on the line. There should be no leading or trailing spaces or tabs on any of the lines.

Leave a blank line after each testcase's output (including that of the last testcase).

Do not use hyphens or the word 'and' in your output. For numbers between 1100 and 9999, use the word thousand. For example, ‘one thousand one hundred one’ and not ‘eleven hundred one’. Note that ‘105’ is ‘one hundred five’ and not ‘hundred five’. Similarly, ‘1103’ is ‘one thousand one hundred three’.
SAMPLE INPUT

2
2 15
11 37

SAMPLE OUTPUT

The symbol [<-NL] is not part of the output; it denotes a blank line.
Output begins on the next line...
two
three
five
seven
eleven
thirteen
                   [<-NL]
eleven
thirteen
seventeen
nineteen
twenty three
twenty nine
thirty one
thirty seven
                   [<-NL]
Output ends on the previous line.