A212193 In ternary representation of n: a(n) = if n is pandigital then 3 else least digit not used.
1, 0, 0, 2, 0, 0, 1, 0, 0, 2, 2, 3, 2, 0, 0, 3, 0, 0, 1, 3, 1, 3, 0, 0, 1, 0, 0, 2, 2, 3, 2, 2, 3, 3, 3, 3, 2, 2, 3, 2, 0, 0, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3, 0, 0, 1, 3, 1, 3, 3, 3, 1, 3, 1, 3, 3, 3, 3, 0, 0, 3, 0, 0, 1, 3, 1, 3, 0, 0, 1, 0, 0, 2, 2, 3, 2, 2
Offset: 0
Examples
. 0 -> '0': a(0) = 1 . 1 -> '1': a(1) = 0 . 2 -> '2': a(2) = 0 . 3 -> '10': a(3) = 2 . 4 -> '11': a(4) = 0 . 5 -> '12': a(5) = 0 . 6 -> '20': a(6) = 1 . 7 -> '21': a(7) = 0 . 8 -> '22': a(8) = 0 . 9 -> '100': a(9) = 2 . 10 -> '101': a(10) = 2 . 11 -> '102': a(11) = 3 <-- 11 is the smallest 3-pandigital number . 12 -> '110': a(12) = 2 . 13 -> '111': a(13) = 0 . 14 -> '112': a(14) = 0 . 15 -> '120': a(15) = 3.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Eric Weisstein's World of Mathematics, Ternary
- Eric Weisstein's World of Mathematics, Pandigital Number
- Wikipedia, Ternary numeral system
- Wikipedia, Pandigital number
Programs
-
Haskell
import Data.List (delete) a212193 n = f n [0..3] where f x ys | x <= 2 = head $ delete x ys | otherwise = f x' $ delete d ys where (x',d) = divMod x 3
Comments