The code is meant to have two functions. the first to determine if an integer is prime the second to show all prime numbers between two integers. so far my first function works fine but I'm getting the error message "Uncaught TypeError: Property 'prime' of object [object Window] is not a function primefeat2-2.html:30" for the second function. cant for the life of me work out whats wrong would appreciate some help I will collaborate them to be two separate options after I have worked out the basic code.

<script type="text/javascript">

function prime(){

var count = 2;
var stop = Math.ceil(Math.sqrt(number1));
var remainder = number1 % count;

while(count < stop){
number1 % count;
if (remainder == 0){
prime = false;
prime = true;
count ++;

function feature2(){

var number1 = window.prompt("enter a number","0");
var number2 = window.prompt("enter a number","0");

while (number1 < number2){
if (prime(number1)){
document.writeln(+ number1 + " is prime");