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.
%I A374024 #40 Jul 28 2024 00:31:02 %S A374024 199,289,379,388,496,559,568,595,739,775,838,955,1099,1189,1198,1468, %T A374024 1495,1585,1738,1747,1765,1792,1855,1990,2098,2494,2665,2881,2890, %U A374024 3169,3196,3259,3349,3466,3493,3745,3790,3880,4249,4519,4735,4951,4960,5149,5482 %N A374024 Integers k such that digsum(k) = digsum(k^2) = p, where p is prime and digsum(i) = A007953(i). %C A374024 Subsequence of A058369. %C A374024 If k is a term, then digsum(k) = 19, 37 or 73, for k < 10^9. %C A374024 If k is an integer such that digsum(k) = digsum(k^2) = p, with p prime, then p == 1 (mod 9) (A061237). %C A374024 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. %C A374024 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 %e A374024 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. %p A374024 ds:= n -> convert(convert(n,base,10),`+`): %p A374024 filter:= proc(n) local p; %p A374024 p:= ds(n); %p A374024 isprime(p) and ds(n^2) = p %p A374024 end proc: %p A374024 select(filter, [seq(i,i=1..1000, 9)]); # _Robert Israel_, Jul 05 2024 %t A374024 Select[Range[5490],PrimeQ[dg=DigitSum[#]]&&(dg==DigitSum[#^2])&] (* _Stefano Spezia_, Jul 05 2024 *) %o A374024 (PARI) isok(k) = my(s=sumdigits(k)); isprime(s) && (s==sumdigits(k^2)); \\ _Michel Marcus_, Jul 06 2024 %Y A374024 Cf. A007953, A058369, A061237, A067272, A254066. %K A374024 nonn,base %O A374024 1,1 %A A374024 _Gonzalo MartÃnez_, Jul 05 2024