// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve.java
import java.io.PrintStream;
public class Sieve
{
public Sieve()
{
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
boolean aflag[] = new boolean[i + 1];
for(int j = 0; j <= i; j++)
aflag[j] = true;
aflag[0] = aflag[1] = false;
int k = (int)Math.ceil(Math.sqrt(i));
for(int l = 0; l <= k; l++)
if(aflag[l])
{
for(int i1 = 2 * l; i1 <= i; i1 += l)
aflag[i1] = false;
}
int j1;
for(j1 = i; !aflag[j1]; j1--);
System.out.println("The largest prime less than or equal to " + i + " is " + j1);
}
}
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve2.java
import java.io.PrintStream;
public class Sieve2
{
public Sieve2()
{
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
int j = (i + 1) / 2;
boolean aflag[] = new boolean[j + 1];
int k = 0;
for(int l = 0; l <= j; l++)
aflag[l] = true;
aflag[0] = false;
aflag[1] = true;
int i1 = (int)Math.ceil(Math.sqrt(i));
for(int j1 = 3; j1 <= i1; j1 += 2)
if(aflag[(j1 - 1) / 2])
{
for(int k1 = 3 * j1; k1 <= i; k1 = k1 + j1 + j1)
aflag[(k1 - 1) / 2] = false;
}
int l1 = 2;
if(i <= 2)
l1 = 2;
else
if(i % 2 == 1 && aflag[(i - 1) / 2])
l1 = i;
else
for(l1 = i - 1 - i % 2; !aflag[(l1 - 1) / 2]; l1 -= 2);
System.out.println("The largest prime less than or equal to " + i + " is " + l1 + " cycle time:" + k);
}
}
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve3.java
import java.io.PrintStream;
public class Sieve3
{
public Sieve3()
{
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
int j = (i + 1) / 2;
boolean aflag[] = new boolean[j + 1];
int k = 0;
for(int l = 0; l <= j; l++)
aflag[l] = true;
aflag[0] = false;
aflag[1] = true;
int i1 = (int)Math.ceil(Math.sqrt(i));
for(int j1 = 3; j1 <= i1; j1 += 2)
if(aflag[(j1 - 1) / 2])
{
for(int k1 = j1 * j1; k1 <= i; k1 = k1 + j1 + j1)
{
int i2 = (k1 - 1) / 2;
if(aflag[i2])
aflag[i2] = false;
}
}
int l1 = 2;
if(i <= 2)
l1 = 2;
else
if(i % 2 == 1 && aflag[(i - 1) / 2])
l1 = i;
else
for(l1 = i - 1 - i % 2; !aflag[(l1 - 1) / 2]; l1 -= 2);
System.out.println("The largest prime less than or equal to " + i + " is " + l1 + " cycle time:" + k);
}
}
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve4.java
import java.io.PrintStream;
public class Sieve4
{
public Sieve4()
{
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
int j = (i + 1) / 2;
long l = System.currentTimeMillis();
boolean aflag[] = new boolean[j + 1];
int k = 0;
aflag[0] = false;
aflag[1] = true;
int i1 = (int)Math.ceil(Math.sqrt(i));
int j1 = (i - 1) / 2 - 1;
for(int l1 = 2; l1 <= j1;)
{
aflag[l1++] = true;
aflag[l1++] = true;
aflag[l1++] = false;
}
long l2 = System.currentTimeMillis() - l;
System.out.println(l2);
int j2 = (i1 - 1) / 2;
int k2 = (i - 1) / 2;
for(int k1 = 2; k1 <= j2; k1++)
if(aflag[k1])
{
for(int i2 = k1 * (2 * k1 + 2); i2 <= k2; i2 = i2 + k1 + k1 + 1)
if(aflag[i2])
aflag[i2] = false;
}
int i3 = 2;
if(i <= 2)
i3 = 2;
else
if(i % 2 == 1 && aflag[(i - 1) / 2])
i3 = i;
else
for(i3 = i - 1 - i % 2; !aflag[(i3 - 1) / 2]; i3 -= 2);
long l3 = System.currentTimeMillis() - l;
System.out.println(l3);
System.out.println("The largest prime less than or equal to " + i + " is " + i3 + " cycle time:" + k);
}
}
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve5.java
import java.io.PrintStream;
public class Sieve5
{
public Sieve5()
{
}
public static int getisp(int i)
{
return isprime[i >> 3] >> (i & 7) & 1;
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
int j = (i + 1) / 2;
isprime = new byte[j / 8 + 2];
int k = 0;
for(int l = 0; l <= j / 8 + 1; l++)
isprime[l] = -1;
isprime[0] &= 0xfe;
isprime[0] |= 2;
int k1 = (int)Math.ceil(Math.sqrt(i));
boolean flag = false;
int i1 = (i - 1) / 2;
for(int i2 = 4; i2 <= i1; i2 += 3)
isprime[i2 >> 3] &= ~(1 << (i2 & 7));
char c = '/0';
int j2 = (k1 - 1) / 2;
int k2 = (i - 1) / 2;
for(int j1 = 2; j1 <= j2; j1++)
{
c++;
if(c == '/003')
c = '/0';
else
if(getisp(j1) == 1)
{
int l1 = ((j1 << 2) + 1) % 3;
for(int l2 = j1 * (2 * j1 + 2); l2 <= k2; l2 = l2 + j1 + j1 + 1)
if(++l1 == 3)
l1 = 0;
else
if(getisp(l2) == 1)
isprime[l2 >> 3] &= ~(1 << (l2 & 7));
}
}
int i3 = 2;
if(i <= 2)
i3 = 2;
else
if(i % 2 == 1 && getisp((i - 1) / 2) == 1)
{
i3 = i;
} else
{
i3 = i - 1 - i % 2;
do
{
int j3 = (i3 - 1) / 2;
if(getisp(j3) == 1)
break;
i3 -= 2;
} while(true);
}
System.out.println("The largest prime less than or equal to " + i + " is " + i3 + " cycle time:" + k);
}
static byte isprime[];
}
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Sieve7.java
import java.io.PrintStream;
public class Sieve7
{
public Sieve7()
{
}
public static int getisp(int i)
{
return isprime[i >> 3] >> (i & 7) & 1;
}
public static void main(String args[])
{
int i = 100;
try
{
i = Integer.parseInt(args[0]);
}
catch(Exception exception) { }
int j = (i + 1) / 2;
isprime = new byte[((j / 8) * 2) / 3 + 2];
int k = 0;
for(int l = 0; l <= ((j / 8) * 2) / 3 + 1; l++)
isprime[l] = -1;
isprime[0] &= 0xfe;
isprime[0] |= 2;
int l1 = (int)Math.ceil(Math.sqrt(i));
boolean flag = false;
int i1 = (i - 1) / 2;
char c = '/0';
for(int j1 = 5; j1 <= l1; j1 += 2)
{
c++;
if(c == '/003')
{
c = '/0';
} else
{
int j2 = j1 / 3;
if(getisp(j2) == 1)
{
int i2 = (j1 + j1) % 3 - 1;
for(int l2 = j1 * j1; l2 <= i; l2 = l2 + j1 + j1)
if(++i2 == 3)
{
i2 = 0;
} else
{
int i3 = l2 / 3;
if(getisp(i3) == 1)
isprime[i3 >> 3] &= ~(1 << (i3 & 7));
}
}
}
}
int k2 = 2;
if(i <= 2)
k2 = 2;
else
if(i <= 4)
k2 = 3;
else
if(i % 2 == 1 && getisp(i / 3) == 1)
{
k2 = i;
} else
{
for(int k1 = (j * 2) / 3; k1 >= 0; k1--)
{
if(getisp(k1) != 1)
continue;
k2 = 3 * k1 + k1 % 2 + 1;
if(k2 < i)
break;
}
}
System.out.println("The largest prime less than or equal to " + i + " is " + k2 + " cycle time:" + k);
}
static byte isprime[];
}