Return lines within line range

sed -n '240000,510000p' example.txt

return single line

sed -n '123{p;q}' example.txt