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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Seiichi Manyama, Sep 29 2018

Keywords

Crossrefs

Programs

  • 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
    def A319798(n)
      i = 1
      ary = [1]
      while g(n, ary) - g(n, ary.reverse) != i
        i += 1
        ary = f(n, i).sort
      end
      i
    end
    def A319839(n)
      (1..n).map{|i| A319798(2 * i)}
    end
    p A319839(20)

Formula

a(n) = A319798(2*n).