%I #6 Mar 30 2012 18:35:53
%S 2,3,5,7,11,12,14,16,21,23,29,32,34,38,41,43,47,56,61,65,74,83,89,92,
%T 98,101,110,111,113,115,120,122,131,133,137,139,140,146,153,155,160,
%U 164,182,186,188,191,203,205,212,214,221,225,227,230,232,236,272,281,287,290,302,304,311,313,319,320,326,331
%N Numbers n such that d(1)^1 + d(2)^2 +...+ d(p)^p and d(1)^p + d(2)^p-1 +...+ d(p)^1 are prime numbers, where d(i), i=1..p, are the digits of n.
%e 1583 is in the sequence because :
%e 1 + 5^2 + 8^3 + 3^4 = 619 and 1^4 + 5^3 + 8^2 + 3^1 = 193 are prime numbers.
%p with(numtheory):for n from 1 to 1000 do:l:=length(n):n0:=n:s1:=0:s2:=0:for
%p m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s1:=s1+u^(l-m+1):s2:=s2+u^m:od:
%p if type(s1,prime)=true and type(s2,prime)=true then printf(`%d, `,n):else fi:od:
%t okQ[n_] := Module[{d=IntegerDigits[n], r}, r=Length[d]; PrimeQ[Total[d^Range[r]]] && PrimeQ[Total[d^Range[r, 1, -1]]]]; Select[Range[1000], okQ]
%Y Cf. A139749 A139750
%K nonn,base
%O 1,1
%A _Michel Lagneau_, Dec 21 2010
|