Question

Please use python and show the code you used. Question 2 5 pts from sympy import sieve sieve.extend_to_no(999) primes - set (sieve._list) The code above creates a set of p

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program Code Screenshot :

Х sieve primes.py - D:7Coding/Python/sieve primes.py (3.7.4) File Edit Format Run Options Window Help from sympy import sieve

Sample Output :

RESTART: D: /Coding/Python/sieve primes.py = = = = II II III II II II = = Decimal is 9419

Program Code to Copy (Please refer to the screenshot of the code to understand the indentation of the code)

from sympy import sieve
sieve.extend_to_no(999)
primes = set(sieve._list)
#List of integers
l = [4987,2049,117,2423,3211,831,8707,2099,6853,5601,79,4301,2909,8311]
#Boolean list
d = [x in primes for x in l]
#Binary number
b = ''.join([str(int(x)) for x in d])
#Convert to decimal
print('Decimal is ',int(b,2))

Add a comment
Know the answer?
Add Answer to:
Please use python and show the code you used. Question 2 5 pts from sympy import...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON 3 - please show format Question 2. ) Use the Design Recipe to write a...

    PYTHON 3 - please show format Question 2. ) Use the Design Recipe to write a function yesOrNo which has no parameters. When called, it gets input from the user until the user types either 'yes' or 'no', at which point the function should return True if the user typed 'yes' and False if the user typed 'no'. Any other entries by the user are ignored and another value must be input. For example: Test Input Result print(yesOrNo()) hello blank...

  • Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA...

    Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA {    private BigInteger phi; private BigInteger e; private BigInteger d; private BigInteger num; public static void main(String[] args) {    Scanner keyboard = new Scanner(System.in); System.out.println("Enter the message you would like to encode, using any ASCII characters: "); String input = keyboard.nextLine(); int[] ASCIIvalues = new int[input.length()]; for (int i = 0; i < input.length(); i++) { ASCIIvalues[i] = input.charAt(i); } String ASCIInumbers...

  • Please use python and show the code used. Question 1 5 pts data = 63.7 67.7...

    Please use python and show the code used. Question 1 5 pts data = 63.7 67.7 67.9 76 -901 80.3 84.8 93.9 84.8 76 80.3 85.8 89.3 93.9 98.5 95.9 183 -901 98.5 97.3 96.2 94 92 -901 88.7 85.9 87 85 88.9 84 82.5 83 81.3 77 79.3 72 -901 67 64 -981 62 -901 85 -901 67.7 72 98.5 97.3 103 84.8 62 -901 85.9 94 -901 98.5 89.3 93.9 93.9 96.2 81.3 67 95.9 88.3 84 82.5...

  • Given java code is below, please use it! import java.util.Scanner; public class LA2a {      ...

    Given java code is below, please use it! import java.util.Scanner; public class LA2a {       /**    * Number of digits in a valid value sequence    */    public static final int SEQ_DIGITS = 10;       /**    * Error for an invalid sequence    * (not correct number of characters    * or not made only of digits)    */    public static final String ERR_SEQ = "Invalid sequence";       /**    * Error for...

  • Please help code in c++ and use the answers you get from question 1 and 2...

    Please help code in c++ and use the answers you get from question 1 and 2 into the 3rd answer! Question 1 is first, question 2 is in the middle, question 3 is last Input Array (10 pts) te a function only (no main) that takes an array of doubles as a parameter as well as another integer rray. Create a for loop that asks the user to input any real number between-100 and r each element of the array....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT