OFFSET
1,1
COMMENTS
"Rotation" of a (multi-digit) number involves taking the first digit of the number and putting it at the end to form a new number. For example, successive rotations of 1234 yield the numbers 2341, 3412 and 4123 (another rotation gives back the original number).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
Ken Duisenberg, Puzzle of the Week (Dec 14, 2001), Dividing Rotated Numbers
EXAMPLE
The rotations of 137179 are 371791, 717913, 179137, 791371, 913717, 137179; all these are divisible by 1, 3, 7 and 9.
MATHEMATICA
ddQ[n_]:=Module[{idn=IntegerDigits[n]}, DigitCount[n, 10, 0]==0 && Length[Union[idn]]>1 && And@@Flatten[Divisible[#, Union[idn]]&/@ (FromDigits/@Table[RotateRight[idn, i], {i, Length[idn]}])]]; Select[Range[10, 200000], ddQ] (* Harvey P. Dale, Mar 30 2011 *)
PROG
(Haskell)
-- import Data.List (nub, inits, tails)
a066484 n = a066484_list !! (n-1)
a066484_list = filter h [1..] where
h x = notElem '0' xs && length (nub xs) > 1 &&
all d (map read $ zipWith (++)
(tail $ tails xs) (tail $ inits xs)) where xs = show x
d u = g u where
g v = v == 0 || mod u d == 0 && g v' where (v', d) = divMod v 10
-- Reinhard Zumkeller, Nov 29 2012
(PARI) select( {is_A066484(n, d=Set(digits(n)))= d[1] && #d>1 && (d[1]>1||d=d[^1]) && !for(i=0, logint(n, 10), n=[1, 10^logint(n, 10)]*divrem(n, 10); [n%x|x<-d]&&return)}, [1..10^5]) \\ M. F. Hasler, Jan 05 2020
CROSSREFS
KEYWORD
base,nice,nonn
AUTHOR
Sudipta Das (juitech(AT)vsnl.net), Jan 02 2002
EXTENSIONS
Corrected and extended by Harvey P. Dale, Mar 30 2011
Definition reworded by M. F. Hasler, Jan 05 2020
STATUS
approved