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.

Showing 1-5 of 5 results.

A004159 Sum of digits of n^2.

Original entry on oeis.org

0, 1, 4, 9, 7, 7, 9, 13, 10, 9, 1, 4, 9, 16, 16, 9, 13, 19, 9, 10, 4, 9, 16, 16, 18, 13, 19, 18, 19, 13, 9, 16, 7, 18, 13, 10, 18, 19, 13, 9, 7, 16, 18, 22, 19, 9, 10, 13, 9, 7, 7, 9, 13, 19, 18, 10, 13, 18, 16, 16, 9, 13, 19, 27, 19, 13, 18, 25, 16, 18, 13, 10, 18, 19, 22, 18, 25, 25, 18, 13
Offset: 0

Views

Author

Keywords

Comments

If 3|n then 9|a(n); otherwise, a(n) == 1 (mod 3). - Jon E. Schoenfield, Jun 30 2018

Examples

			Trajectories under the map x -> a(x):
1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 -> ...
2 ->  4 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
3 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 -> ...
4 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
5 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
6 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 -> ...
7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
- _R. J. Mathar_, Jul 08 2012
		

Crossrefs

Cf. A240752 (first differences), A071317 (partial sums).
Cf. A062685 (smallest square with digit sum n, or 0 if no such square exists).

Programs

  • Haskell
    a004159 = a007953 . a000290  -- Reinhard Zumkeller, Apr 12 2014
    
  • Maple
    read("transforms"):
    A004159 := proc(n)
            digsum(n^2) ;
    end proc: # R. J. Mathar, Jul 08 2012
  • Mathematica
    a004159[n_Integer] := Apply[Plus, IntegerDigits[n^2]]; Table[
    a004159[n], {n, 0, 100}] (* Michael De Vlieger, Jul 21 2014 *)
    Total[IntegerDigits[#]]&/@(Range[0,100]^2) (* Harvey P. Dale, Feb 03 2019 *)
  • PARI
    A004159(n)=sumdigits(n^2) \\ M. F. Hasler, Sep 23 2014
  • Python
    def A004159(n):
        return sum(int(d) for d in str(n*n)) # Chai Wah Wu, Sep 03 2014
    

Formula

a(n) = A007953(A000290(n)); a(A058369(n)) = A007953(A058369(n)). - Reinhard Zumkeller, Apr 25 2009
a(10n) = a(n). If n > 1 is not a multiple of 10, then a(n)=4 iff n = 10^k+1 = A062397(k), a(n)=7 iff n is in A215614={4, 5, 32, 49, 149, 1049}, and else a(n) >= 9. - M. F. Hasler, Sep 23 2014

A226803 Primes p where the digital sum of p^2 is equal to 7.

Original entry on oeis.org

5, 149, 1049
Offset: 1

Views

Author

Vincenzo Librandi, Jun 24 2013

Keywords

Comments

No more terms below 10^9. - Michel Marcus, Nov 02 2013
No more terms below 10^20. - Hiroaki Yamanouchi, Sep 23 2014

Examples

			5 is in the sequence because 5^2 = 25 and 2 + 5 = 7.
149 is in the sequence because 149^2 = 22201 and 2 + 2 + 2 + 0 + 1 = 7.
		

Crossrefs

Subsequence of A215614.

Programs

  • Magma
    [p: p in PrimesUpTo(6*10^6) | &+Intseq(p^2) eq 7];
    
  • Mathematica
    Select[Prime[Range[10000]], Total[IntegerDigits[#^2]] == 7 &]
  • PARI
    lista(nn) = {forprime(p=2, nn, if (sumdigits(p^2)==7, print1(p, ", ")););} \\ Michel Marcus, Nov 02 2013

Extensions

Keywords fini,full, since unproven, removed by Max Alekseyev, Jun 20 2025

A262711 Numbers k such that sum of digits of k^2 is 7.

Original entry on oeis.org

4, 5, 32, 40, 49, 50, 149, 320, 400, 490, 500, 1049, 1490, 3200, 4000, 4900, 5000, 10490, 14900, 32000, 40000, 49000, 50000, 104900, 149000, 320000, 400000, 490000, 500000, 1049000, 1490000, 3200000, 4000000, 4900000, 5000000, 10490000, 14900000
Offset: 1

Views

Author

Vincenzo Librandi, Sep 28 2015

Keywords

Comments

Subsequence of A156638. [Bruno Berselli, Sep 28 2015]

Examples

			4 is in sequence because 4^2 = 16 and 1+6 = 7.
		

Crossrefs

Cf. sum of digits of n^2 is k: A052216 (k=4), this sequence (k=7), A262712 (k=9), A262713 (k=10).
Cf. A215614.

Programs

  • Magma
    [n: n in [1..2*10^7] | &+Intseq(n^2) eq 7];
    
  • Mathematica
    Select[Range[10^7], Total[IntegerDigits[#^2]] == 7 &]
  • PARI
    for(n=1, 1e8, if (sumdigits(n^2) == 7, print1(n", "))) \\ Altug Alkan, Sep 28 2015

A384094 Numbers whose square has digit sum 9 and no trailing zero.

Original entry on oeis.org

3, 6, 9, 12, 15, 18, 21, 39, 45, 48, 51, 102, 105, 111, 201, 249, 318, 321, 348, 351, 501, 549, 1002, 1005, 1011, 1101, 1149, 1761, 2001, 4899, 5001, 10002, 10005, 10011, 10101, 10149, 11001, 14499, 20001, 50001, 100002, 100005, 100011, 100101, 101001, 110001, 200001, 375501, 500001, 1000002
Offset: 1

Views

Author

M. F. Hasler, Jun 15 2025

Keywords

Comments

All numbers of the form 10^a + 10^b + 1 (i.e., A052216+1 = 3*A237424) and of the form 10^a + 5*10^b with min(a, b) = 0 (i.e., A133472 U A199685), are in this sequence. Terms not of this form are (9, 18, 39, 45, 48, 249, 318, 321, 348, 351, 549, 1149, 1761, 4899, 10149, 14499, 375501, ...), see subsequence A384095. (Is this sequence finite? What is the next term?)
Is it true that no number > 1049 = A215614(6) has a square with digit sum less than 9, other than the trivial 1 and 4?

Crossrefs

Cf. A004159 (sum of digits of n^2), A215614 (sumdigits(n^2) = 7), A133472 (10^n + 5), A199685 (5*10^n + 1), A052216 (10^a + 10^b), A237424 ((10^a + 10^b + 1)/3).
See also: A058414 (digits(n^2) in {0,1,4}).

Programs

  • PARI
    select( {is_A384094(n)=n%10 && sumdigits(n^2)==9}, [1..10^5])

A384095 Numbers other than {10^a + 10^b + 1} and {10^a + 5*10^b, min(a, b) = 0} whose square has digit sum 9 and no trailing zero.

Original entry on oeis.org

9, 18, 39, 45, 48, 249, 318, 321, 348, 351, 549, 1149, 1761, 4899, 10149, 14499, 375501
Offset: 1

Views

Author

M. F. Hasler, Jun 15 2025

Keywords

Comments

The definition excludes the two "regular" subsequences of A384094, namely A052216+1 = 3*A237424 and A133472 U A199685, which provide most of its terms.
Is it true that no number > 1049 = A215614(6) has a square with digit sum less than 9, other than the trivial 1 and 4?
The next term, if it exists, is a(18) > 10^8.
a(18) > 10^14 if it exists. - Robert Israel, Jun 15 2025
a(18) > 10^40 if it exists. - Chai Wah Wu, Jun 19 2025

Crossrefs

Cf. A004159 (sum of digits of n^2), A384094 (sumdigits(n^2) = 9), A133472 (10^n+5), A199685 (5*10^n + 1), A052216 (10^a+10^b), A237424 ((10^a+10^b+1)/3).
See also: A215614 (sumdigits(n^2) = 7), A058414 (digits(n²) ⊂ {0,1,4}).

Programs

  • Maple
    extend:= proc(a,d) local i,s;
        s:= convert(convert(a,base,10),`+`);
        op(select(t -> numtheory:-quadres(t,10^d)=1, [seq(i*10^(d-1)+a, i=0 .. 9 - s)]))
    end proc:
    istriv:= proc(n) local L;
       L:= subs(0=NULL,convert(n,base,10));
       member(L, [[4],[5],[6],[1,1],[1,1,1],[1,2],[2,1],[1,5],[5,1]])
    end proc:
    R:= NULL:
    A:= [1,4,5,6,9]:
    for d from 2 to 20 do
      A:= map(extend,A,d);
      V:= select(t -> t > 10^(d-1) and issqr(t) and convert(convert(t,base,10),`+`)=9, A);
      if V <> [] then V:= sort(remove(istriv,map(sqrt,V))); R:= R,op(V); fi
    od:
    R;# Robert Israel, Jun 15 2025
  • PARI
    select( {is_A384095(n)=n%10 && sumdigits(n^2)==9 && !bittest(36938, fromdigits(Set(digits(n))))}, [1..10^5])
Showing 1-5 of 5 results.