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.

A319839 Smallest fixed points (>0) of the base-2*n Kaprekar map.

This page as a plain text file.
%I A319839 #24 Oct 23 2018 10:34:13
%S A319839 9,30,105,21,495,858,65,2040,2907,133,5313,6900,225,10962,13485,341,
%T A319839 19635,23310,481,31980,37023,645,48645,55272,833,70278,78705,1045,
%U A319839 97527,107970,1281,131040,143715,1541,171465,186588,1825,219450,237237,2133,275643,296310,2465
%N A319839 Smallest fixed points (>0) of the base-2*n Kaprekar map.
%H A319839 Seiichi Manyama, <a href="/A319839/b319839.txt">Table of n, a(n) for n = 1..100</a>
%H A319839 <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a>
%F A319839 a(n) = A319798(2*n).
%o A319839 (Ruby)
%o A319839 def f(k, n)
%o A319839   ary = []
%o A319839   while n > 0
%o A319839     ary << n % k
%o A319839     n /= k
%o A319839   end
%o A319839   ary
%o A319839 end
%o A319839 def g(k, ary)
%o A319839   (0..ary.size - 1).inject(0){|s, i| s + ary[i] * k ** i}
%o A319839 end
%o A319839 def A319798(n)
%o A319839   i = 1
%o A319839   ary = [1]
%o A319839   while g(n, ary) - g(n, ary.reverse) != i
%o A319839     i += 1
%o A319839     ary = f(n, i).sort
%o A319839   end
%o A319839   i
%o A319839 end
%o A319839 def A319839(n)
%o A319839   (1..n).map{|i| A319798(2 * i)}
%o A319839 end
%o A319839 p A319839(20)
%Y A319839 Cf. A099009, A163205, A165016, A165055, A165094, A319798.
%K A319839 nonn,base,look
%O A319839 1,1
%A A319839 _Seiichi Manyama_, Sep 29 2018