Write an algorithm to determine the encryption key.
The input consists of an integer – numMessage, representing the numeric form of the message.
The Output prints an integer representing the encryption key
Note: Digits 1 and 0 are considered as a prime number
num=int(input("Enter the Number = ")) temp=num s=0 while(temp!=0): c=temp%10 d=0 for i in range(2,10): if c%i==0 and c!=i: d=d+1 break else: d=d+0 if d!=0 and c!=0 and c!=1: s=s+c temp=int(temp/10) print(s)
Sample
Input:
45673
Output:
10
Explanation: The non-prime digits are 4 and 6. Hence, the output is 4+6=10
Output:
Enter the Number = 45673
10
Output:
Enter the Number = 56895
23
Output:
Enter the Number = 562151
6
Output:
Enter the Number = 10020
0
Output:
Enter the Number = 56000
6
Output:
Enter the Number = 123456
10
Output:
Enter the Number = 98765432
27
More Codes to Fcuk
- Armstrong Number
- Find the biggest even number
- Program to replace every element on right side
- Compute the frequency of the note
- Print all Possible Combinations from three Digits.
- Get number n and Compute n+nn+nnn
- Print Cube root of the given number
- Convert number into binary, octal and hexa
- Return maximum number of operations performed on array.
- Determine the encryption key
- Find the count of numbers having a prime number in their binary representation.
- Fibonacci Series up to given n numbers
- Help Alice find the route to her home
Explore
- Quantum Mechanics relation with quantum computing
- Unzipping Files using Python
- An Algorithm which accepts n integer values and calculates the average and prints it.
- How can Quantum Computing merge with Virtual Reality ? !
- Blockchain and Cryptocurrency. And their relations with Virtual Reality !!