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.

User: Anwar Hahj Jefferson-George

Anwar Hahj Jefferson-George's wiki page.

Anwar Hahj Jefferson-George has authored 1 sequences.

A380725 Positive integers k whose sum of digits equals the square of their number of digits.

Original entry on oeis.org

1, 13, 22, 31, 40, 108, 117, 126, 135, 144, 153, 162, 171, 180, 207, 216, 225, 234, 243, 252, 261, 270, 306, 315, 324, 333, 342, 351, 360, 405, 414, 423, 432, 441, 450, 504, 513, 522, 531, 540, 603, 612, 621, 630, 702, 711, 720, 801, 810, 900, 1069, 1078, 1087, 1096, 1159, 1168, 1177, 1186, 1195
Offset: 1

Author

Comments

This is a finite sequence since if k is L digits long then its sum of digits is at most 9*L which is < L^2 for L > 9.

Crossrefs

Cf. A007953 (sum of digits), A061384.

Programs

  • Mathematica
    Select[Range[1200],DigitSum[#]==IntegerLength[#]^2&] (* James C. McMahon, Feb 18 2025 *)
  • PARI
    isok(k) = my(d=digits(k)); vecsum(d) == sqr(#d); \\ Michel Marcus, Feb 08 2025
    
  • Python
    def ok(n): return sum(map(int, s:=str(n))) == len(s)**2
    print([k for k in range(2000) if ok(k)]) # Michael S. Branicky, Feb 08 2025
  • Rust
    /// Is the term a valid entry in a380725
    pub fn a380725_predicate(mut k: usize) -> bool {
        let base = 10usize;
        let mut len = 0usize;
        let mut digit_sum = 0usize;
        while k > 0 {
            let digit = k.rem_euclid(base);
            k /= base;
            digit_sum += digit;
            len += 1;
        }
        digit_sum == len.pow(2u32)
    }