What is the smallest palindromic prime whose cube can be expressed as the sum of three odd cubes ?
I wonder if 3 is palindromic. If not, 757 fits the bill as below:
rabbit-3:~ lord$ t3
3 = 1^3 + 1^3 + 1^3
757 = 1^3 + 3^3 + 9^3
16561 = 13^3 + 13^3 + 23^3
73037 = 19^3 + 19^3 + 39^3
77977 = 13^3 + 19^3 + 41^3
rabbit-3:~ lord$ more t3.f
program t3
implicit none
integer*8 y3(1000000,4),num(8),i1,i2,i3,icnt,
1 i,j,ndig,n,dum,half
icnt=0
do i1=1,101,2
do i2=i1,101,2
do i3=i2,101,2
icnt=icnt+1
y3(icnt,4)=i1**3+i2**3+i3**3
y3(icnt,1)=i1
y3(icnt,2)=i2
y3(icnt,3)=i3
enddo
enddo
enddo
do 1 i=3,icnt,2
call isprime(i,n)
if (n.eq.0)go to 1
ndig=log10(1.*i)+1
dum=i
do j=ndig-1,1,-1
num(j+1)=dum/10**j
dum=dum-num(j+1)*10**j
enddo
num(1)=dum
half=(ndig+1)/2
do j=1,half
if(num(j).ne.num(ndig+1-j))go to 1
enddo
do j=1,1000000
if(y3(j,4).ne.i)go to 2
print 3,i,y3(j,1),y3(j,2),y3(j,3)
3 format(i6, ' =',2(2x,i3,'^3 + '),2x,i3,'^3')
2 enddo
1 enddo
end
subroutine isprime(i,n)
implicit none
integer*8 i,j,k,l,m,n
n=1
if(i.eq.2)return
n=0
k=sqrt(1.*i)
do j=2,k
m=(1.*i)/(1.*j)
l=m*j
if(l.eq.i)go to 1
enddo
n=1
1 return
end
Edited on October 27, 2018, 11:58 am