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.

A380585 a(n) = floor(n^2 / 10^m) + (n^2 mod 10^m) where m is the number of decimal digits in n.

Original entry on oeis.org

0, 1, 4, 9, 7, 7, 9, 13, 10, 9, 1, 22, 45, 70, 97, 27, 58, 91, 27, 64, 4, 45, 88, 34, 81, 31, 82, 36, 91, 49, 9, 70, 34, 99, 67, 37, 108, 82, 58, 36, 16, 97, 81, 67, 55, 45, 37, 31, 27, 25, 25, 27, 31, 37, 45, 55, 67, 81, 97, 115, 36, 58, 82, 108, 136, 67, 99
Offset: 0

Views

Author

Giorgos Kalogeropoulos, Mar 27 2025

Keywords

Comments

The positive fixed points of this sequence are the Kaprekar numbers (A053816).
The sum of two halves of the decimal expansion of n^2 after having added a leading 0 if that number of digits is odd. - Michel Marcus, Mar 28 2025

Crossrefs

Cf. A053816 (fixed points), A055642, A344851, A358072 (similar plot).

Programs

  • Maple
    a:= n-> (k-> iquo(n^2, k)+(n^2 mod k))(10^length(n)):
    seq(a(n), n=0..66);  # Alois P. Heinz, Mar 27 2025
  • Mathematica
    Table[m=IntegerLength@n; Floor[n^2/10^m] + Mod[n^2,10^m], {n,0,66}]
  • PARI
    a(n) = my(d=digits(n^2)); if (#d % 2, d = concat(0, d)); my(m=#d/2); fromdigits(Vec(d,m)) + fromdigits(vector(#d-m, i, d[m+i])); /* Michel Marcus, Mar 28 2025 */
  • Python
    def a(n): return (nn:=n**2)//(M:=10**len(str(n))) + nn%M
    print([a(n) for n in range(0, 67)]) # Michael S. Branicky, Mar 27 2025