<SCRIPT LANGUAGE="VBSCRIPT">
DIM i,n,j
n = 100
DOCUMENT.WRITE("Prime nos are")&space(1)&"1"&space(2)&"2"&space(2)
X=0
FOR j = 3 TO n
FOR i = 2 TO (j-1)
IF i MOD j <> 0 THEN
DOCUMENT.WRITE(i)&space(2)
X=1
END IF
NEXT
NEXT
<html> <script language="vbscript"> n=cint(inputbox("Enter a number")) dim f f=1 if n<0 then Msgbox "Invalid number" elseif n=0 or n=1 then MsgBox "The factorial of given number "&n&" is :"&f else for i=n to 2 step -1 f=f*i next MsgBox "The factorial of given number "&n&" is :"&f end if </script> </html>
The prime factors of 24 are 2 and 3.
Here is a simple program to generate prime numbers upto a given specific number /*Prime No. from 1 to 50*/ /*By-Himanshu Rathee*/ #include<stdio.h> #include<conio.h> void main() { int i,j,n; clrscr(); printf(" Enter the number upto which we have to find the prime number: "); scanf("%d",&n); printf("\n"); for(i=2;i<=n;i++) { for(j=2;j<=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(); }
flow chart to find whther the given number is perfect or not
draw a flowchart to find the biggest number among the 3 numbers
//some students also asked it with alert dialog box ! I have done it in a HTML page 100% working best of Luck !_Z triplezero here :) <script type="text/javascript"> var inum, icount=2; var irem; inum = prompt("Enter a number."); if(inum==1) { alert("The no. is not prime"); document.write("The no. is not prime"); exit(0); } if(inum==2) { alert("The no. is prime"); document.write("The no. is prime"); exit(0); } do { irem=inum%icount; if(irem==0) { alert("The no. is not prime"); document.write("the given no is not prime"); exit(0); } icount++; } while(icount<=(inum/2)); alert("The no. is prime"); document.write("the given number is prime"); </script>
17,017
By dividing it by the prime factors that have no remainders
To find twin primes of a given number, iterate through the numbers starting from the given number, and for each number, check if both the number and the number+2 are prime. If they are, then they form a pair of twin primes with the given number.
A number which is divisible by itself and 1 is called prime number. A prime number has only two factors.But, 836475 is also divisible by5, i.e. 836475 has more than two factors.Therefore, the given number is not prime.In order to show that given number is not prime there is no need to find all the factors, we should show that given number has more than two factors.
Prime numbers have two and only two factors. If the number has more than two factors, it is not prime.
you see if it can be divided by any numbers that are not 1 or itself
#include<stdio.h> #include<conio.h> void main() { int n,a=2; clrscr(); printf("\n enter n"); scanf("%d",&n); if(i<=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
they can help you by finding the two factors of the number given
Sure, since there are INFINITELY MANY prime numbers, that means you will find prime numbers over any given number.
As people have been trying to find a script of some sort using the most powerful computers in the world for 60 years to no result, so no one can assist you in this question yet...
Start with the lowest prime factors 2, 3, 5, 7 etc and work up.