# Tag Info

1

This seems to accomplish what you wanted, but it's not returning your result. I have commented the code a bit more heavily than usual to show how I put it together and what it accomplishes: hopefully this may be helpful to you in constructing similar functions in the future. function[a_, b_] := Module[ {factorlist, listofsolutions, toCR}, (* Generate ...

2

Walk through this a step at a time with each line of input followed by the line of (* output *) a = 17; b = 697; F = FactorInteger[a*(27*b^2 + a^6)] (* {{2, 2}, {13, 1}, {17, 3}, {37, 1}, {67, 1}} *) v = Map[First[#]^Last[#] &, F] (* {4, 13, 4913, 37, 67} *) (* When it returns {ReplaceAll[x],p} there was no solution *) {x/.ToRules[Reduce[{(x+a)^3==-b, ...

1

Essentially all you need to get your code to terminate is Convert Mod[b^k!, n] to PowerMod[b, k!, n] (b^k! caused the overflow). Break out of your loop once p has been found. Here's your code with these slight modifications. (I also added Monitor to see the progress.) n = 140016480344628383; b = 2; y = 0; z = 0; p = 0; Monitor[ For[k = 0, k <= ...

2

As this is a PE question, my answer is deliberately vague and incomplete. Consider rewriting the equation as $z^2 - y^2 = x^2 - 1$. Expand the left-hand side as $(z-y)(z+y)=p*q=x^2-1$, and identify $p=z-y$ and $q=z+y$. Thus, $z=(q+p)/2$ and $y=(q-p)/2$. The restriction of non-decreasing $x\le y\le z$ implies a lower bound on $q$ from $y=(q-p)/2\ge x$. Use ...

2

the simple approach works ok if you just need the first few thousand.. allxyz = Append[##, Sqrt[Total[#^2] - 1]] & /@ Select[ Tuples[ Range[2, 1000], {2}] , IntegerQ[Sqrt[Total[#^2] - 1]] & ]; Show[{ListPlot[allxy[[All, 1 ;; 2]]]}] Better...FindInstance is much happier if we give it a z value and find x,y: This ...

5

Diophantus's approach Diophantus (Book II, problem 9) gives parameterized solutions to x^2 + y^2 == z^2 + a^2, here parametrized by C[1], which may be a rational number (different than 1). We can use his method to find solutions to the OP's case, a == 1. Since Diophantus' method produces rational solutions, we have to clear denominators to get a solution ...

3

The quickest route here, from a syntactic standpoint, is to use Reduce, which allows you to request that the equation to be simplified by eliminating a set of variables, and to restrict those variables to a given domain, all at once: Reduce[a^2/b^2 == 2, {a, b}, Integers] (* False *) As shown in Marius Ladegård Meyer's answer, you need to square both ...

16

As far as obtaining a True/False answer: In[11]:= Element[Sqrt[2], Rationals] Out[11]= False

6

How about FullSimplify[ Exists[{a, b}, Element[a, Integers] && Element[b, Integers] && ! MemberQ[Divisors[b], a] && a^2/b^2 == 2]] (* False *)

2

Solution that finds pairs where both x,y > 1 The other solutions miss values where both x>1 and y>1. For example, x=11, y=7, z=13. First, iterate through the pairs of integers. I order the pairs {1,1}, {2,1}, {2,2}, {3,1}, {3,2}, ...: pair[1] = {1, 1} pair[n_] /; MatchQ[pair[n - 1], {x_, x_}] := pair[n] = {1, 0} pair[n - 1] + {1, 1} pair[n_] := ...

5

FindInstance supports an optional argument that defines how many instances it should find. For example, this code will find 10 distinct solutions to your equation: {x, y, z} /. FindInstance[ x^2 + y^2 == z^2 + 1 && x > 0 && y > 0 && z > 0, {x, y, z}, Integers, 10] {{2, 1, 2}, {600, 1, 600}, {1, 69, 69}, {114, 1, ...

0

Maybe the function Solve and Select will help. set = (Solve[c^2 + Q^4 - 2 == 0 && c - Q^2 - 2046 == 0, {c, Q}, Modulus -> 3072]); Select[set, Mod[(#)[[1, 2]], 1536] == 511 && Mod[(#)[[2, 2]], 768] == 1 &] The result is {{c->511,Q->769},{c->511,Q->2305},{c->2047,Q->1},{c->2047,Q->1537}} We'd better to use c than C since the ...

Top 50 recent answers are included