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.

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