cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A360423 Positive integers n (with k digits) such that if a positive integer m with k+1 digits is divisible by n, then all the rotations of m are divisible by n.

This page as a plain text file.
%I A360423 #29 Feb 24 2023 18:37:08
%S A360423 1,3,9,27,37,101,303,909,2439,10101,10989,12987,15873,25641,27027,
%T A360423 30303,37037,47619,76923,90909,1010101,1369863,3030303,9090909,
%U A360423 12345679,27027027,37037037,101010101,243902439,303030303,909090909,10101010101,10989010989,12987012987,15873015873
%N A360423 Positive integers n (with k digits) such that if a positive integer m with k+1 digits is divisible by n, then all the rotations of m are divisible by n.
%C A360423 John D. Cook's blog (see link below) provides a proof that "if a three-digit number is divisible by 37, it remains divisible by 37 if you rotate its digits."
%H A360423 John D. Cook, <a href="https://www.johndcook.com/blog/2023/02/12/rotating-multiples-of-37/">Rotating multiples of 37</a>.
%e A360423 For a(4)=27, 405 is a 3-digit multiple of 27, and the two rotations of 405 (i.e., 54 and 540) are also multiples of 27.
%e A360423 For a(5)=37, 185 is a 3-digit multiple of 37, and the two rotations of 185 (i.e., 851 and 518) are also multiples of 37.
%e A360423 For a(9)=2439, 12195 is a 5-digit multiple of 2439, and the four rotations of 12195 (i.e., 21951, 19512, 95121 and 51219) are also multiples of 2439.
%o A360423 (Python)
%o A360423 def rotate(str):
%o A360423     first_char = str[0 : 1]
%o A360423     remaining_chars = str[1 :]
%o A360423     return (remaining_chars + first_char)
%o A360423 def get_rotations(n):
%o A360423     n_as_str = str(n)
%o A360423     rotations = []
%o A360423     rotation_as_str = n_as_str
%o A360423     for i in range(len(n_as_str) - 1):
%o A360423         rotation_as_str = rotate(rotation_as_str)
%o A360423         rotations.append(int(rotation_as_str))
%o A360423     return rotations
%o A360423 seq = []
%o A360423 max_n = 9999999
%o A360423 for n in range(1, max_n + 1):
%o A360423     n_len = len(str(n))
%o A360423     factor = 2
%o A360423     while True:
%o A360423         prod = n * factor
%o A360423         prod_len = len(str(prod))
%o A360423         if prod_len < n_len + 1:
%o A360423             factor = factor + 1
%o A360423         elif prod_len > n_len + 1:
%o A360423             seq.append(n)
%o A360423             break
%o A360423         else:
%o A360423             # prod_len == n_len + 1
%o A360423             rotations = get_rotations(prod)
%o A360423             if all(rotation % n == 0 for rotation in rotations):
%o A360423                 factor = factor + 1
%o A360423             else:
%o A360423                 break
%o A360423 print(seq)
%Y A360423 Cf. A034089, A066484.
%K A360423 nonn,base
%O A360423 1,2
%A A360423 _Robert C. Lyons_, Feb 14 2023
%E A360423 a(25)-a(35) from _Chai Wah Wu_, Feb 24 2023