'''simple docstring'''

from __future__ import annotations







def      UpperCamelCase_						(					snake_case_       :       int | float | str						,		snake_case_       :       int | float | str      )					->     list[str]:






 '''simple docstring'''

 if nth_term == "":
  return [""]
 __lowerCAmelCase											=						int(snake_case_      )
 __lowerCAmelCase											=						int(snake_case_      )
 __lowerCAmelCase											=						[]
 for temp in range(int(snake_case_      )      ):
  series.append(f"""1 / {pow(temp + 1						,		int(snake_case_      )      )}""" if series else """1"""      )
 return series


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 _A			:      Any					      =				int(input('''Enter the last number (nth term) of the P-Series'''))
 _A			:      Optional[int]					      =				int(input('''Enter the power for  P-Series'''))
 print('''Formula of P-Series => 1+1/2^p+1/3^p ..... 1/n^p''')
 print(p_series(nth_term, power))







'''simple docstring'''

import numpy as np
import qiskit







def      UpperCamelCase_						(					snake_case_       :       int = 8						,		snake_case_       :       int | None = None      )					->     str:






 '''simple docstring'''

 __lowerCAmelCase											=						np.random.default_rng(seed=snake_case_      )

 # Roughly 25% of the qubits will contribute to the key.
 # So we take more than we need.
 __lowerCAmelCase											=						6 * key_len
 # Measurement basis for Alice's qubits.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )
 # The set of states Alice will prepare.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )
 # Measurement basis for Bob's qubits.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )

 # Quantum Circuit to simulate BB84
 __lowerCAmelCase											=						qiskit.QuantumCircuit(snake_case_						,		name="""BB84"""      )

 # Alice prepares her qubits according to rules above.
 for index, _ in enumerate(snake_case_      ):
  if alice_state[index] == 1:
   bbaa_circ.x(snake_case_      )
  if alice_basis[index] == 1:
   bbaa_circ.h(snake_case_      )
 bbaa_circ.barrier()

 # Bob measures the received qubits according to rules above.
 for index, _ in enumerate(snake_case_      ):
  if bob_basis[index] == 1:
   bbaa_circ.h(snake_case_      )

 bbaa_circ.barrier()
 bbaa_circ.measure_all()

 # Simulate the quantum circuit.
 __lowerCAmelCase											=						qiskit.Aer.get_backend("""aer_simulator"""      )
 # We only need to run one shot because the key is unique.
 # Multiple shots will produce the same key.
 __lowerCAmelCase											=						qiskit.execute(snake_case_						,		snake_case_						,		shots=1						,		seed_simulator=snake_case_      )
 # Returns the result of measurement.
 __lowerCAmelCase											=						job.result().get_counts(snake_case_      ).most_frequent()

 # Extracting the generated key from the simulation results.
 # Only keep measurement results where Alice and Bob chose the same basis.
 __lowerCAmelCase											=						"""""".join(
     [
         result_bit
         for alice_basis_bit, bob_basis_bit, result_bit in zip(
             snake_case_						,		snake_case_						,		snake_case_      )
         if alice_basis_bit == bob_basis_bit
     ]      )

 # Get final key. Pad with 0 if too short, otherwise truncate.
 __lowerCAmelCase											=						gen_key[:key_len] if len(snake_case_      ) >= key_len else gen_key.ljust(snake_case_						,		"""0"""      )
 return key


if __name__ == "__main__":
 print(f'The generated key is : {bbaa(8, seed=0)}')
 from doctest import testmod

 testmod()






