Friday, August 23, 2024

Numbers

 Working through Lesson 6, on algorithms. No joking, finding quantum advantage

cannot be in terms of seconds to run a certain program...


Interesting look at prime factorization. Python's math module accepts this code, and

outputs quickly:


                                                        


For instance, if you input the number 650, the output will be 2 5 5 13, representing the prime factors of 650. Feel free to try it out! 😊

you

what does n//= i mean?

Copilot

Certainly! The expression n //= i is a shorthand for integer division with assignment. It divides the value of n by i and assigns the result back to n. In other words, it updates n to be the floor division of n by i.
For example:
If n is initially 10 and i is 3, then n //= i results in n becoming 3 (since 10 divided by 3 is 3 with no remainder).
If n is initially 15 and i is 4, then n //= i results in n becoming 3 (since 15 divided by 4 is 3 with a remainder of 3).
Feel free to ask if you have any more questions! 😊

                                                                    *     *     *

  The **RSA Factoring Challenge** was a significant initiative by RSA Laboratories to encourage research in computational number theory and the practical difficulty of factoring large integers used in cryptography. Here are the key points:

1. **Challenge Overview**:

   - RSA Laboratories published a list of semiprimes (numbers with exactly two prime factors) known as the **RSA numbers**.

   - The challenge was to factorize these numbers into their prime components.

   - The smallest of these, **RSA-100**, a 100-decimal digit number, was factored by April 1, 1991.

   - Larger numbers remained unfactored for quite some time.


2. **Purpose and Application**:

   - The challenge helped track the cutting edge in integer factorization.

   - It provided insights into choosing key lengths for the RSA public-key encryption scheme.

   - RSA Laboratories used it as an incentive for the academic community to test the strength of their solutions.


3. **Challenge Numbers**:

   - The RSA numbers were generated without any network connection.

   - The computer generating them had its hard drive destroyed to prevent any record of the solutions.

   - The challenge included both decimal and binary representations of numbers.


4. **Legacy and Conclusion**:

   - The RSA Factoring Challenges ended in 2007.

   - Only RSA-576 and RSA-640 were factored from the 2001 challenge numbers.

   - Advances in quantum computers (such as Shor's algorithm) may impact future factorization efforts.


In summary, the RSA Factoring Challenge played a crucial role in understanding the security of RSA-based encryption. 🌟

*     *     *

The first bit in a binary just codes 0 or 1, but the subsequent ones are all powers of 2.

possible values:   8   4   2   1
my_num:             1   1   0   0  thus represents 12, and the 8 is 2^3.


So what is 2^1023??

                                                                         





Feminine

 Exercises for women. Nice and not too tiring...


Thursday, August 22, 2024

Transpile


 My job from yesterday ran at 5 am, and took 4 seconds to complete. All it was:

two very simple little circuits. 

                                                                      


So there isclearly a lot of upfront work being done during transpilation. When a classical

program is compiled, that means it is translated into machine language. In the process, we

are informed whether the program will run or not!


When a quantum program is transpiled, things are different:

                                                            


Transpiling is the topic of IBMLearn lesson 6, which I am going to next...

Wednesday, August 21, 2024

Time_It

 Rainy day...

Thinking it might be fun to work up a time-consuming function, and 

run it both as a python function, and a quantum one. Just to see!!


You

If I run a python program on my (Windows 11) tablet is there any way I can find out how long it 

took to execute?

Copilot

Certainly! You can measure the execution time of a Python program using several methods. Here are a few options:

Wall Time (Total Elapsed Time): This measures the total time elapsed during execution, including waiting time for resources. You can use the time.time() function to get the wall time in seconds1.

CPU Execution Time: This measures the time the CPU spends actively processing your program’s instructions. It excludes waiting time for other tasks (like I/O operations). To get the CPU execution time, use time.process_time()1.

Using the timeit Module: The timeit module provides a convenient way to measure execution time for small code snippets. It runs your code multiple times and returns the total time taken2.

Function-Specific Timing: If you want to measure the execution time of a specific function, you can use timeit.timeit() with the appropriate setup and statement3.

Choose the method that best suits your needs, and you’ll be able to accurately measure the execution time of your Python program! 😊 

                                              *     *     *

PYTHON

import time

start_time = time.time()  # Record the start time

# Your time-consuming task goes here

end_time = time.time()    # Record the end time

elapsed_time = end_time - start_time

print(f"The task took {elapsed_time:.2f} seconds to complete.")

                                           *     *     *

As expected, the python code fared better than the qiskit code for a simulator

running with python.

For yesterday's code finding that number 9 is odd:

                                                            



Running on pure python:

                                                                              

Running on an actual quantum machine is quite different. Long story short, all

a true quantum computer does is evaluate circuits!

I'm in the queue at ibm_sherbrooke with a two qubit circuit. We'll see tomorrow

morning...




Tuesday, August 20, 2024

EvenOdd

 Manged to produce a sequence that accepts a number, converts it to binary,

draws a circuit of the binary, and outputs whether it is even or odd. Below!

My initial ambition what to use but one qubit to determine parity - on the

model of the Deutch circuit - but that is not possible. The Deutsch circuit

works because that last measure on one actually encompasses everything

on the circuit. This is not the case for a plain even/odd, which only needs

to use one qubit...

                                                       










Monday, August 19, 2024

Vein Health

 So here is something to watch out for in adopting health and beauty

routines from Youtube. A lot of the advice is fine, but not everything goes

together, In particular: lymphatic drainage and varicose vein treatment.

Lymphatic drainage relies on massage to the legs toward the heart, and 

sometimes quite vigorous. But that can be quite a burden on the veins.


A medical video explained it: the arteries which pump blood from the heart are

quite rigid. But veins, which bring the blood.back to the heart by the action of leg

muscles are squishy. And they do repair themselves to some extent, but

without those all-important portals. Varicose veins respond to exercise to

strenghten leg muscles!!


Below, a fun video, not too strenuous for vein work:

Sunday, August 18, 2024

Deutsch's

 Started work on IBMQuantumLearn for Algorithms(lesson 5). Got to appreciate

Deutsch's algorithm. 

Classical Computing:

                                                                     


Quantum Computing:


An example query, parity:


Here an either/or only between a contant or balanced function.





                                                                            
Compilation:

https://www.perplexity.ai/search/quantum-computing-can-you-show-.Dd6MDOVTBi43qhd_eRaCw

One just asks for the case one wants. Below, function(4):

                                                      

Function(4) on Quirk: