Post Reply 
hp prime symbolic arithmetic test
01-23-2020, 08:36 AM (This post was last modified: 01-23-2020 08:38 AM by yangyongkang.)
Post: #1
hp prime symbolic arithmetic test
Regarding the problem of truncable primes, python-like code
Code:
#cas
def SelectPrimeAppendNum(num,n):
  return select(x->isprime(x),[seq(num+10^(n-1)*k,k=1..9)])
def TruncatedPrimeNumber(n):
    if n==1:
     return [2,3,5,7]
     else:
      return CONCAT(map(TruncatedPrimeNumber(n-1),x->SelectPrimeAppendNum(x,n)))  
#end

Symbolic operation:
Code:
#cas
def calc():
  r:=1
  c:=sqrt(3);
  d:=sqrt(2);
  p:=coeff(x^2/c^2+(k*(x-a)+b)^2/d^2-1,x);
  sol:=[-p[1]/p[0]-a,k*(-p[1]/p[0]-2a)+b];
  m:=normal([seq(subst(sol,k=[(a*b+r*sqrt(a^2+b^2-r^2))/(a^2-r^2),(a*b-r*sqrt(a^2+b^2-r^2))/(a^2-r^2)][n]),n=0..1)]);
  q:=normal([seq(subst((x*y+(-1)^(k)*r*sqrt(x^2+y^2-r^2))/(x^2-r^2),[x=m[k,0],y=m[k,1]]),k=0..1)]);
  z:=normal(zeros(seq(y-(q[k]*(x-m[k,0])+m[k,1]),k=0..1),[x,y])[0]);
  if tlin(subst(z[0]^2/3267+z[1]^2/2738,[a=sqrt(3)*cos(t),b=sqrt(2)*sin(t)]))==1/2209:
    return true
  return false
#end


Attached File(s) Thumbnail(s)
   

study hard, improve every day
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)