All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Palindromic and prime (Posted on 2013-12-30)
For what values of x the expression 2x^2+2x+1 is palindromic and prime?

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution Comment 1 of 1

10   for X=1 to 999999
20   Y=2*X*(X+1)+1
30   if prmdiv(Y)=Y then
40     :if fnPalin(Y)=1 then print X,Y
45   if prmdiv(Y)=0 then print "x=";X;"y=";Y;" is too big":end
50   next
60   end
1000   fnPalin(N)
1010     T=1:S=cutspc(str(N))
1020     for I=1 to int(len(S)/2)
1030       if mid(S,I,1)<>mid(S,len(S)+1-I,1) then T=0
1040     next
1050    return(T)

`finds  x      expression 1       5 9       181 12      313 1262    3187813x= 92682 y= 17180091613  is too big`

The last line indicates that when x got to 92,682, the expression became 17,180,091,613, which is too large for the test of primality used in the program.

 Posted by Charlie on 2013-12-30 17:45:16

 Search: Search body:
Forums (1)