answersLogoWhite

0


Best Answer

(defun prime (num)

(if (< 2 num)

(do ((dividend 2 (1 + dividend))

(chk-to (sqrt num)))

((equal (rem num dividend) 0))

(when (<= chk-to dividend)

(return t)))

t))

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program in lisp to find if a number is prime or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you write a program in Python to find the first n prime numbers?

One way to do this is to write a function that checks if a number is prime: def isPrime(number): for i in range(2, number): if number%i == 0: return False return True Then create variables to track how many primes have been found and a variable to track which number is being tested for being prime. Increment that variable and test it, and if it is prime print it out (or save it somewhere) and increment the variable being used to track how many primes have been found: targetPrimes = 10 #number of primes to find primesFound = 0 #number of primes found i = 1 while (primesFound &lt; targetPrimes): i += 1 #first number tested is 2 if isPrime(i): print(i) primesFound += 1


Write a c program to find out the prime numbers between 1 to 500?

Here is a simple program to generate prime numbers upto a given specific number /*Prime No. from 1 to 50*/ /*By-Himanshu Rathee*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int i,j,n; clrscr(); printf(" Enter the number upto which we have to find the prime number: "); scanf("%d",&amp;n); printf("\n"); for(i=2;i&lt;=n;i++) { for(j=2;j&lt;=i-1;j++) if(i%j==0) break; /*Number is divisble by some other number. So break out*/ if(i==j) printf("\t%d",i); /*Number was divisible by itself (that is, i was same as j)*/ } /*Continue loop upto nth number*/ getch(); }


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


How do you write Square program using vb?

write a vb program to find the magic square


Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class

Related questions

What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one prime number was generated, divide the big int number by the prime number. If the remainder is zero then quotient is the second prime number ( also it is important to check whether the quotient is prime number or not because sometimes you will get wrong answer). Repeat the process until you get the result.


A program to find that the input number is prime or not?

Use Wolfram|Alpha... go to the related link below, Wolfram|Alpha, and type in (is __ (number) prime) and then the program will compute that and tell you if it is prime or composite.


write a pseudocode to accept a number and find if it is prime or not?

Yes


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


Prime numbers between 1 to 10 in microprocessor 8085?

program to find prime number in 8085 microprocessor


Write a Shell program to find the smallest number from a set of numbers?

k


Write a java programme to check whether the number is twin prime or not?

Find a prime number, add 2 to the number. Check if the new number is prime. IE : 3 is prime. 3+2 =5. 5 is prime. (3,5) are twin primes.


How do you write a program to find whether the given number is prime or not and show output?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int n,a=2; clrscr(); printf("\n enter n"); scanf("%d",&amp;n); if(i&lt;=a-1) { if(a%i==0) { printf("\n the given number is not a prime number"); break; } i++; if(a==i) { printf("\n the given number is a prime number"); } getch(); output: enter the value of n:2 the given number is prime number


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.