Posts

Showing posts from December, 2025

Miller-Rabin Primality Test and Caching IV

Image
It is interesting to ask the time complexity of a LC solution to ChatGPT, especially if it involves a complex algorithm like Miller-Rabin Primality Testing. This one is a good example: Complete Prime Number - LeetCode You are given an integer  num . A number  num  is called a  Complete Prime Number  if every  prefix  and every  suffix  of  num  is  prime . Return  true  if  num  is a Complete Prime Number, otherwise return  false . Note : A  prefix  of a number is formed by the  first   k  digits of the number. A  suffix  of a number is formed by the  last   k  digits of the number. A  prime  number is a natural number greater than 1 with only two factors, 1 and itself. Single-digit numbers are considered Complete Prime Numbers only if they are  prime .   Example 1: Input:   num = 23 Output:   true Explanation: ​​​​​​​ Prefi...