Skip to content

Instantly share code, notes, and snippets.

@junpeitsuji
Created September 7, 2016 08:54
Show Gist options
  • Save junpeitsuji/401e1ed3397c900a7fa0646eefbdab59 to your computer and use it in GitHub Desktop.
Save junpeitsuji/401e1ed3397c900a7fa0646eefbdab59 to your computer and use it in GitHub Desktop.
def jonessatowadawiens(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
res=(k+2)*(1-(w*z+h+j-q)**2 \
-((g*k+2*g+k+1)*(h+j)+h-z)**2 \
-(2*n+p+q+z-e)**2 \
-(16*((k+1)**3)*(k+2)*((n+1)**2)+1-f**2)**2 \
-((e**3)*(e+2)*((a+1)**2)+1-o**2)**2 \
-((a**2-1)*(y**2)+1-x**2)**2 \
-(16*(r**2)*(y**4)*(a**2-1)+1-u**2)**2 \
-(((a+(u**2)*(u**2-a))**2-1)*(n+4*d*y)**2+1-(x+c*u)**2)**2 \
-(n+l+v-y)**2-((a**2-1)*(l**2)+1-m**2)**2 \
-(a*i+k+1-l-i)**2 \
-(p+l*(a-n-1)+b*(2*a*n+2*a-n**2-2*n-2)-m)**2 \
-(q+y*(a-p-1)+s*(2*a*p+2*a-(p**2)-2*p-2)-x)**2 \
-(z+p*l*(a-p)+t*(2*a*p-(p**2)-1)-p*m)**2)
return res
end
def f(x)
#jonessatowadawiens(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24], x[25])
jonessatowadawiens(20,0,0,0,3,1,0,1,0,0,0,0,1,0,244,1,1,0,0,0,1,0,0,1,0,1)
end
x = Array.new(26, 0)
random = Random.new
p f(x)
=begin
1000000.times do |t|
x.size.times do |i|
x[i] = random.rand(0..10000)
end
res = f(x)
p res
if res > 0
p res
break
end
end
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment