Daily Coding Challenge - Circular Prime

Tell us what’s happening:

Why 197 only has three circular numbers, not 6? How these circular numbers are generated? Thanks.

Your code so far

import math
def is_circular_prime(n):
    result = list(str(n))
    arr = set()
    for i in range(len(result)):
        number = [result[i]]+result[0:i]+result[i+1:]
        arr.add(int(''.join(number)))
    print(arr)
    def prime(num):
        if num<=3:
            return True
        for i in range(2,math.ceil(num**0.5)):
            if num%i ==0:
                return False
        return True
    return all(prime(s) for s in arr)

print(is_circular_prime(197))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Circular Prime
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-01-09

because the circular numbers are not the permutations
You get the circular numbers like this:

  1. repeat the number twice, so 197197
  2. take three consecutive digits from this number, starting from the 1 there is 197, startnign from the 9 there is 971 and starting from the 7 there is 719