|
|
A319839
|
|
Smallest fixed points (>0) of the base-2*n Kaprekar map.
|
|
2
|
|
|
9, 30, 105, 21, 495, 858, 65, 2040, 2907, 133, 5313, 6900, 225, 10962, 13485, 341, 19635, 23310, 481, 31980, 37023, 645, 48645, 55272, 833, 70278, 78705, 1045, 97527, 107970, 1281, 131040, 143715, 1541, 171465, 186588, 1825, 219450, 237237, 2133, 275643, 296310, 2465
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
|
|
PROG
|
(Ruby)
def f(k, n)
ary = []
while n > 0
ary << n % k
n /= k
end
ary
end
def g(k, ary)
(0..ary.size - 1).inject(0){|s, i| s + ary[i] * k ** i}
end
i = 1
ary = [1]
while g(n, ary) - g(n, ary.reverse) != i
i += 1
ary = f(n, i).sort
end
i
end
end
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|