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.

A058369 Numbers k such that k and k^2 have same digit sum.

Original entry on oeis.org

0, 1, 9, 10, 18, 19, 45, 46, 55, 90, 99, 100, 145, 180, 189, 190, 198, 199, 289, 351, 361, 369, 379, 388, 450, 451, 459, 460, 468, 495, 496, 550, 558, 559, 568, 585, 595, 639, 729, 739, 775, 838, 855, 900, 954, 955, 990, 999, 1000, 1098, 1099, 1179, 1188, 1189
Offset: 1

Views

Author

G. L. Honaker, Jr., Dec 17 2000

Keywords

Comments

It is interesting that the graph of this sequence appears almost identical as the maximum value of n increases by factors of 10. Compare the graph of the b-file (having numbers up to 10^6) with the plot of the terms up to 10^8. - T. D. Noe, Apr 28 2012
If iterated digit sum (A010888, A056992) is used instead of just digit sum (A007953, A004159), we get A090570 of which this sequence is a subset. - Jeppe Stig Nielsen, Feb 18 2015
Hare, Laishram, & Stoll show that this sequence (indeed, even its subsequence A254066) is infinite. In particular for each k in {846, 847, 855, 856, 864, 865, 873, ...} there are infinitely many terms in this sequence not divisible by 10 that have digit sum k. - Charles R Greathouse IV, Aug 25 2015
There are infinitely many n such that both n and n+1 are in the sequence. This includes A002283. - Robert Israel, Aug 26 2015

Examples

			Digit sum of 9 = 9 9^2 = 81, 8+1 = 9 digit sum of 145 = 1+4+5 = 10 145^2 = 21025, 2+1+0+2+5 = 10 digit sum of 954 = 9+5+4 = 18 954^2 = 910116, 9+1+0+1+1+6 = 18. - Florian Roeseler (hazz_dollazz(AT)web.de), May 03 2010
		

Crossrefs

Cf. A147523 (number of numbers in each decade).
Subsequence of A090570.

Programs

  • Haskell
    import Data.List (elemIndices)
    import Data.Function (on)
    a058369 n = a058369_list !! (n-1)
    a058369_list =
       elemIndices 0 $ zipWith ((-) `on` a007953) [0..] a000290_list
    -- Reinhard Zumkeller, Aug 17 2011
    
  • Magma
    [n: n in [0..1200] |(&+Intseq(n)) eq (&+Intseq(n^2))]; // Vincenzo Librandi, Aug 26 2015
    
  • Maple
    sd := proc (n) options operator, arrow: add(convert(n, base, 10)[j], j = 1 .. nops(convert(n, base, 10))) end proc: a := proc (n) if sd(n) = sd(n^2) then n else end if end proc; seq(a(n), n = 0 .. 1400); # Emeric Deutsch, May 11 2010
    select(t -> convert(convert(t,base,10),`+`)=convert(convert(t^2,base,10),`+`),
    [seq(seq(9*i+j,j=0..1),i=0..1000)]); # Robert Israel, Aug 26 2015
  • Mathematica
    Select[Range[0,1200],Total[IntegerDigits[#]]==Total[IntegerDigits[ #^2]]&] (* Harvey P. Dale, Jun 14 2011 *)
  • PARI
    is(n)=sumdigits(n)==sumdigits(n^2) \\ Charles R Greathouse IV, Aug 25 2015
    
  • Python
    def ds(n): return sum(map(int, str(n)))
    def ok(n): return ds(n) == ds(n**2)
    def aupto(nn): return [m for m in range(nn+1) if ok(m)]
    print(aupto(1189)) # Michael S. Branicky, Jan 09 2021

Formula

A007953(a(n)) = A004159(a(n)). - Reinhard Zumkeller, Apr 25 2009

Extensions

Edited by N. J. A. Sloane, May 30 2010

A261586 Odd numbers n such that the sum of the binary digits of n equals the sum of the binary digits of n^2.

Original entry on oeis.org

1, 3, 7, 15, 31, 63, 79, 91, 127, 157, 159, 183, 187, 255, 279, 287, 317, 319, 351, 365, 375, 379, 445, 511, 573, 575, 637, 639, 703, 735, 751, 759, 763, 815, 893, 975, 1023, 1071, 1087, 1145, 1149, 1151, 1215, 1255, 1277, 1279, 1407, 1449, 1455, 1463
Offset: 1

Views

Author

Keywords

Comments

A077436 consists of elements of this sequence times powers of 2.
Hare, Laishram, & Stoll show that this sequence is infinite. In particular for each k in {12, 13, 16, 17, 18, 19, 20, ...} there are infinitely many terms in this sequence with binary digit sum k.
Subsequence of A077436.

Examples

			15 = 1111_2 and 15^2 = 11100001_2, both of which have a Hamming weight (sum of binary digits) equal to 4.
		

Crossrefs

Programs

  • Magma
    [n: n in [1..1500 by 2] | &+Intseq(n, 2) eq &+Intseq(n^2, 2) ]; // Vincenzo Librandi, Aug 30 2015
  • Mathematica
    Select[Range[1, 1463, 2], Total@ IntegerDigits[#, 2] == Total@ IntegerDigits[#^2, 2] &] (* Michael De Vlieger, Aug 29 2015 *)
  • PARI
    is(n)=n%2 && hammingweight(n)==hammingweight(n^2)
    

A351650 Integers m such that digsum(m) divides digsum(m^2) where digsum = sum of digits = A007953.

Original entry on oeis.org

1, 2, 3, 9, 10, 11, 12, 13, 18, 19, 20, 21, 22, 24, 27, 30, 31, 33, 36, 42, 45, 46, 54, 55, 63, 72, 74, 81, 90, 92, 99, 100, 101, 102, 103, 108, 110, 111, 112, 113, 117, 120, 121, 122, 123, 126, 128, 130, 132, 135, 144, 145, 153, 162, 171, 180, 189, 190, 191, 198
Offset: 1

Views

Author

Bernard Schott, Feb 16 2022

Keywords

Comments

This is a generalization of a problem proposed by French site Diophante in link.
The smallest term k such that the corresponding quotient = n is A280012(n).
The quotient is 1 iff m is in A058369 \ {0}.
If k is in A061909, then digsum(k^2) = digsum(k)^2.
If k is a term, 10*k is also a term.
There are infinitely many m such that both m and m+1 are in the sequence, for example subsequence A002283 \ {0}.
Corresponding quotients are in A351651.

Examples

			digit sum of 42 = 4+2 = 6; then 42^2 = 1764, digit sum of 1764 = 1+7+6+4 = 18; as 6 divides 18, 42 is a term.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[200], Divisible[Total[IntegerDigits[#^2]], Total[IntegerDigits[#]]] &] (* Amiram Eldar, Feb 16 2022 *)
  • PARI
    is(n)=sumdigits(n^2)%sumdigits(n) == 0 \\ David A. Corneth, Feb 16 2022
    
  • Python
    def sd(n): return sum(map(int, str(n)))
    def ok(n): return sd(n**2)%sd(n) == 0
    print([m for m in range(1, 200) if ok(m)]) # Michael S. Branicky, Feb 16 2022

Formula

A004159(a(n)) = A007953(a(n)) * A351651(n).

Extensions

More terms from David A. Corneth, Feb 16 2022

A351651 a(n) is the quotient obtained when digsum(m^2) is divided by digsum(m), with digsum = sum of digits = A007953 and m = A351650(n).

Original entry on oeis.org

1, 2, 3, 1, 1, 2, 3, 4, 1, 1, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 1, 1, 2, 1, 3, 2, 2, 2, 1, 2, 1, 1, 2, 3, 4, 2, 2, 3, 4, 5, 3, 3, 4, 5, 3, 3, 2, 4, 3, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 3, 4, 3, 3, 2, 3, 4, 5, 3, 2, 4, 5, 2, 2, 3, 3, 3, 3, 2, 2, 2, 3, 2, 1, 3, 4, 3, 4, 5
Offset: 1

Views

Author

Bernard Schott, Feb 16 2022

Keywords

Comments

All positive integers are terms of this sequence (see A280012).
a(n) = 1 iff m = A351650(n) is a term of A058369 \ {0}.
a(n) = digsum(n) if m = A351650(n) is a term of A061909 \ {0}.

Examples

			A351650(8) = 13, then digsum(13) = 1+3 = 4 while digsum(13^2) = digsum(169) = 1+6+9 = 16; hence, a(8) = 16/4 = 4.
		

Crossrefs

Programs

  • Mathematica
    Select[Total[IntegerDigits[#^2]]/Total[IntegerDigits[#]]& /@ Range[300], IntegerQ] (* Amiram Eldar, Feb 16 2022 *)
  • PARI
    lista(nn) = {my(list = List(), q); for (n=1, nn, if (denominator(q=sumdigits(n^2)/sumdigits(n))==1, listput(list, q));); Vec(list);} \\ Michel Marcus, Feb 16 2022

Formula

a(n) = A004159(A351650(n)) / A007953(A351650(n)).

Extensions

More terms from Michel Marcus, Feb 16 2022

A374024 Integers k such that digsum(k) = digsum(k^2) = p, where p is prime and digsum(i) = A007953(i).

Original entry on oeis.org

199, 289, 379, 388, 496, 559, 568, 595, 739, 775, 838, 955, 1099, 1189, 1198, 1468, 1495, 1585, 1738, 1747, 1765, 1792, 1855, 1990, 2098, 2494, 2665, 2881, 2890, 3169, 3196, 3259, 3349, 3466, 3493, 3745, 3790, 3880, 4249, 4519, 4735, 4951, 4960, 5149, 5482
Offset: 1

Views

Author

Gonzalo Martínez, Jul 05 2024

Keywords

Comments

Subsequence of A058369.
If k is a term, then digsum(k) = 19, 37 or 73, for k < 10^9.
If k is an integer such that digsum(k) = digsum(k^2) = p, with p prime, then p == 1 (mod 9) (A061237).
This sequence has infinitely many terms of the form 1999...9 (A067272). If p is a prime with p == 1 (mod 9), i.e., p = 9m + 1 for some m, then t = 2*10^m - 1 = 1999...9, i.e., 1 followed by m 9's, is in this sequence since digsum(t) = 9m + 1 = p and t^2 = 39...960...01, where there are (m - 1) 9's and (m - 1) 0's, so digsum(t^2) = 3 + 9*(m - 1) + 6 + 1 = 9m + 1 = p. Dirichlet's theorem guarantees the existence of infinitely many primes of the form 9w + 1 and hence infinitely many terms of this sequence.
2*10^m - 1 is the least number with digit sum 9*m + 1. Since the next prime congruent to 1 (mod 9) after 73 is 109 = 9*12 + 1, the first term with digit sum other than 19, 37 or 73 is 2*10^12 - 1. - Robert Israel, Jul 07 2024

Examples

			199 is a term, because its digital sum is 1 + 9 + 9 = 19 and 199^2 = 39601, whose digital sum is 3 + 9 + 6 + 0 + 1 = 19, which is prime.
		

Crossrefs

Programs

  • Maple
    ds:= n -> convert(convert(n,base,10),`+`):
    filter:= proc(n) local p;
      p:= ds(n);
      isprime(p) and ds(n^2) = p
    end proc:
    select(filter, [seq(i,i=1..1000, 9)]); # Robert Israel, Jul 05 2024
  • Mathematica
    Select[Range[5490],PrimeQ[dg=DigitSum[#]]&&(dg==DigitSum[#^2])&] (* Stefano Spezia, Jul 05 2024 *)
  • PARI
    isok(k) = my(s=sumdigits(k)); isprime(s) && (s==sumdigits(k^2)); \\ Michel Marcus, Jul 06 2024
Showing 1-5 of 5 results.