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.

A185076 a(n) is the least number k such that (sum of digits of k^2) + (number of digits of k^2) = n, or 0 if no such k exists.

Original entry on oeis.org

0, 1, 0, 10, 2, 100, 11, 1000, 4, 3, 6, 8, 19, 35, 7, 16, 34, 106, 13, 41, 24, 17, 37, 107, 323, 43, 124, 317, 67, 113, 63, 114, 134, 343, 83, 133, 367, 1024, 167, 374, 264, 314, 386, 1043, 313, 583, 1303, 3283, 707, 1183, 3316, 836, 1333, 3286, 10133
Offset: 1

Views

Author

Carmine Suriano, Feb 23 2011

Keywords

Comments

a(n) < sqrt(10^(n-1)). 0 < a(2m) <= 10^(m-1) with the upper bound reached for 1<=m<=4. - Chai Wah Wu, Mar 15 2023

Examples

			a(7)=11 since 7 = sumdigits(121) + numberdigits(121) = 4 + 3.
		

Crossrefs

Programs

  • Mathematica
    Table[k=1; While[d=IntegerDigits[k^2]; n>Length[d] && n != Total[d] + Length[d], k++]; If[Length[d] >= n, k=0]; k, {n, 50}]
  • Python
    from itertools import count
    def A185076(n):
        for k in count(1):
            if n == (t:=len(s:=str(k**2)))+sum(map(int,s)):
                return k
            if t >= n:
                return 0 # Chai Wah Wu, Mar 15 2023

Formula

n = A004159(a(n)) + A185679(a(n)).