%I #14 Apr 11 2016 23:26:13
%S 2,16,22,25,61,118,133,193,217,226,232,262,265,286,310,337,358,397,
%T 433,445,466,496,508,538,553,565,580,613,652,697,718,733,745,757,781,
%U 790,856,901,958,985,988,1021,1093,1186,1201,1210,1258,1273,1285,1297,1312,1321
%N Numbers n such that the sum of the digits of the numbers from 1 to n is a prime.
%H Paolo P. Lava, <a href="/A271627/b271627.txt">Table of n, a(n) for n = 1..10000</a>
%e 1 + 2 = 3 that is a prime; 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 + 1 + 1 + 1 + 2 + 1 + 3 + 1 + 4 + 1 + 5 + 1 + 6 = 73 that is a prime.
%p with(numtheory): P:=proc(q) local a,b,c,k,n; a:=0;
%p for n from 1 to q do b:=0; c:=n; for k from 1 to ilog10(n)+1 do b:=b+(c mod 10); c:=trunc(c/10); od; a:=a+b;
%p if isprime(a) then print(n); fi; od; end: P(10^4);
%t Select[Range@ 1350, PrimeQ@ Total@ Map[Total@ IntegerDigits@ # &, Range@ #] &] (* _Michael De Vlieger_, Apr 11 2016 *)
%o (PARI) isok(n) = isprime(sum(k=1, n, sumdigits(k))); \\ _Michel Marcus_, Apr 11 2016
%Y Cf. A000040, A037123.
%K nonn,easy,base
%O 1,1
%A _Paolo P. Lava_, Apr 11 2016