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.

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

This page as a plain text file.
%I A380725 #41 Feb 18 2025 15:35:17
%S A380725 1,13,22,31,40,108,117,126,135,144,153,162,171,180,207,216,225,234,
%T A380725 243,252,261,270,306,315,324,333,342,351,360,405,414,423,432,441,450,
%U A380725 504,513,522,531,540,603,612,621,630,702,711,720,801,810,900,1069,1078,1087,1096,1159,1168,1177,1186,1195
%N A380725 Positive integers k whose sum of digits equals the square of their number of digits.
%C A380725 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.
%H A380725 Anwar Hahj Jefferson-George, <a href="/A380725/b380725.txt">Table of n, a(n) for n = 1..74583</a>
%t A380725 Select[Range[1200],DigitSum[#]==IntegerLength[#]^2&] (* _James C. McMahon_, Feb 18 2025 *)
%o A380725 (Rust)
%o A380725 /// Is the term a valid entry in a380725
%o A380725 pub fn a380725_predicate(mut k: usize) -> bool {
%o A380725     let base = 10usize;
%o A380725     let mut len = 0usize;
%o A380725     let mut digit_sum = 0usize;
%o A380725     while k > 0 {
%o A380725         let digit = k.rem_euclid(base);
%o A380725         k /= base;
%o A380725         digit_sum += digit;
%o A380725         len += 1;
%o A380725     }
%o A380725     digit_sum == len.pow(2u32)
%o A380725 }
%o A380725 (PARI) isok(k) = my(d=digits(k)); vecsum(d) == sqr(#d); \\ _Michel Marcus_, Feb 08 2025
%o A380725 (Python)
%o A380725 def ok(n): return sum(map(int, s:=str(n))) == len(s)**2
%o A380725 print([k for k in range(2000) if ok(k)]) # _Michael S. Branicky_, Feb 08 2025
%Y A380725 Cf. A007953 (sum of digits), A061384.
%K A380725 nonn,base,fini,full,easy
%O A380725 1,2
%A A380725 _Anwar Hahj Jefferson-George_, Jan 30 2025