The Best Assignment Help

holmes assignment help

ROBIN MILLER CODE | JAVA

ROBIN MILLER CODE | JAVA

  1. CODING FOR GRAPHIC PRIME:

bundle javaapplication2;

import java.awt.*;

import java.awt.geom.*;

import javax.swing.*;

open class GraphingData expands JPanel {

double[] information = {

10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093,10099, 10103, 10111 ,10133, 10139, 10141 ,10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211 ,10223, 10243, 10247 ,10253, 10259, 10267, 10271, 10273, 10289, 10301 ,10303, 10313, 10321, 10331, 10333, 10337 ,10343, 10357, 10369 ,10391 ,10399 ,10427 ,10429 ,10433 ,10453, 10457, 10459 ,10463, 10477, 10487, 10499, 10501, 10513

};

last int PAD = 20;

secured void paintComponent(Graphics g) {

super.paintComponent(g);

Graphics2D g2 = (Graphics2D)g;

g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,

RenderingHints.VALUE_ANTIALIAS_ON);

int w = getWidth();

int h = getHeight();

/for Drawing ordinates.

g2.draw(new Line2D.Double(PAD, PAD, PAD, h-PAD));

/for Drawing abcissa.

g2.draw(new Line2D.Double(PAD, h-PAD, w-PAD, h-PAD));

twofold xInc = (double)(w – 2*PAD)/(data.length-1);

twofold scale = (double)(h – 2*PAD)/getMax();

/for denoting the points(data focuses)

Request NOW

g2.setPaint(Color.red);

for(int I = 0; I < data.length; i++) {

twofold x = PAD + i*xInc;

twofold y = h – PAD – scale*data[i];

g2.fill(new Ellipse2D.Double(x-2, y-2, 4, 4));

}

}

private int getMax() {

int most extreme = – Integer.MAX_VALUE;

for(int I = 0; I < data.length; i++) {

if(data[i] > most extreme)

most extreme = (int) data[i];

}

return most extreme;

}

open static void main(String[] args) {

JFrame f = new JFrame();

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.add(new GraphingData());

f.setSize(400,400);

f.setLocation(200,200);

f.setVisible(true);

}

}

2  CODING FOR  RABIN-MILLER ALGORITHM:

import java.util.Scanner;

import java.util.Random;

import java.math.BigInteger;

open class MillerRabin

{

open boolean isPrimenumber(long m, int iterationnumber)

{

on the off chance that (m == 0 || m == 1)

return false;

on the off chance that (m == 2)

return genuine;

on the off chance that (m % 2 == 0)

return false;

long t = m – 1;

while (t % 2 == 0)

t/= 2;

Irregular ran = new Random();

for (int j = 0; j < iterationnumber; j++)

{

long r = Math.abs(ran.nextLong());

long a = r % (m-1) + 1, tempnum = t;

long mod = modPow(a, tempnum, m);

while (tempnum != m – 1 && mod != 1 && mod != m – 1)

{

mod = mulMod(mod, mod, m);

tempnum *= 2;

}

on the off chance that (mod != m – 1 && tempnum % 2 == 0)

return false;

}

return genuine;

}

open long modPow(long x, long y, long z)

{

long res = 1;

for (int j = 0; j < y; j++)

{

res *= x;

res %= z;

}

return res % z;

}

open long mulMod(long x, long y, long mod)

{

return BigInteger.valueOf(x).multiply(BigInteger.valueOf(y)).mod(BigInteger.valueOf(mod)).longValue();

}

/utilizing Main Function

open static void primary (String[] args)

{

Scanner filter = new Scanner(System.in);

System.out.println(“Using Miller Rabin Primality Algorithm Testn”);

MillerRabin mr = new MillerRabin();

System.out.println(“Enter the correct numbern”);

long number = scan.nextLong();

System.out.println(“nEnter the Iteration number”);

int k = scan.nextInt();

boolean prime = mr.isPrimenumber(number, k);

in the event that (prime)

System.out.println(“n”+ number +” is primenumber”);

else

System.out.println(“n”+ number +” isn’t a primenumber is an Inconclusive”);

}

}

CODING FOR IMPLEMENTING NEW CLASS:

bundle javaapplication3;

import java.util.Scanner;

open class NewClass {

open static void main(String[] args) {

int x,i,y = 0, b, a;int n = 0;

Scanner s = new Scanner(System.in);

System.out.println(“enter the whole number”);

a =s.nextInt();

System.out.println(“enter the no.of emphasess”);

for(i=0;i<n;i++)

{

if(n>0||n<10)

{

}

n= s.nextInt();

}

System.out.println(“Enter the number to check “);

y = s.nextInt();

s.close();

in the event that (y == 0 || y == 1)

System.out.println(y +” the number is Prime nor Composite” );

for (x = 2; x <= y – 1; x++) {

in the event that (y % x == 0) {

System.out.println(y +” the number is Composite” );

break;

}

}

in the event that (y == x)

System.out.println(y +”  the number is uncertain ” );

}

}

CODING FOR PRIMENUMBERS 10000-11000

open class Prime_number {

open static void main(String[] args) {

int bring down = 10000, higher = 11000;

while (bring down < higher) {

boolean banner = false;

for(int j = 2; j <= lower/2; ++j) {

/circling condition

if(lower % j == 0) {

signal = genuine;

break;

}

}

on the off chance that (!signal)

System.out.println(lower + ” “);

++lower;

The Best Assignment help is one of the best website for assignment help. For more details you may contact us at thebestassignmenthelp@gmail.com or call at +447418324884, +918607503827

Leave a Comment

Your email address will not be published. Required fields are marked *