login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Positive integers in which the sum of the k-th powers of their digits is a prime number for k = 1, 2, 3, 4, 5, and 6 but not for k=7.
0

%I #25 Jan 20 2023 10:00:54

%S 223,232,322,1349,1394,1439,1493,1934,1943,2023,2032,2203,2230,2302,

%T 2320,3022,3149,3194,3202,3220,3419,3491,3914,3941,4139,4193,4319,

%U 4391,4913,4931,9134,9143,9314,9341,9413,9431,10349,10394,10439,10493,10934,10943,13049,13094,13409,13490,13904,13940

%N Positive integers in which the sum of the k-th powers of their digits is a prime number for k = 1, 2, 3, 4, 5, and 6 but not for k=7.

%e 223 belongs to this sequence because 2+2+3=7, 2^2+2^2+3^2=17, 2^3+2^3+3^3=43, 2^4+2^4+3^4=113, 2^5+2^5+3^5=307, and 2^6+2^6+3^6=857 are prime numbers whereas 2^7+2^7+3^7 is a composite number.

%p filter:= proc(n) local L,t,k;

%p L:= convert(n,base,10);

%p andmap(isprime, [seq(add(t^k,t=L),k=1..6)]) and not isprime(add(t^7,t=L))

%p end proc:

%p select(filter, [$1..20000]); # _Robert Israel_, Jan 03 2023

%t For[a = 0, a <= 9, a++,

%t For[b = 0, b <= 9, b++,

%t For[c = 0, c <= 9, c++,

%t For[d = 0, d <= 9, d++,

%t If[PrimeQ[a + b + c + d] == True &&

%t PrimeQ[a^2 + b^2 + c^2 + d^2] == True &&

%t PrimeQ[a^3 + b^3 + c^3 + d^3] == True &&

%t PrimeQ[a^4 + b^4 + c^4 + d^4] == True &&

%t PrimeQ[a^5 + b^5 + c^5 + d^5] == True &&

%t PrimeQ[a^6 + b^6 + c^6 + d^6] == True &&

%t PrimeQ[a^7 + b^7 + c^7 + d^7] == False, Print[a, b, c, d]]]]]]

%t (* This code outputs all the terms of the sequence in the interval [1,10^4]. *)

%o (PARI) isok(n) = my(d=digits(n)); for (i=1, 6, if (!isprime(sum(k=1,#d, d[k]^i)), return(0))); !isprime(sum(k=1,#d, d[k]^7)); \\ _Michel Marcus_, Jan 02 2023

%Y Cf. A028834, A108662, A225534, A210767, A245358.

%K nonn,base,easy

%O 1,1

%A _José Hernández_, Jan 02 2023