ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 10 Sep 2020 01:15:09 +0200I cannot seem to figure out what's wrong with the following Sage / Pari-GP codehttps://ask.sagemath.org/question/53388/i-cannot-seem-to-figure-out-whats-wrong-with-the-following-sage-pari-gp-code/Basically, I would like to search for counterexamples to my conjecture that
$$(2xy - \sigma(xy)) < (2x - \sigma(x))(\sigma(y) - y)$$
where $\sigma$ is the sum of divisors.
I tried using the following Pari-GP script in [Sage Cell Server](https://sagecell.sagemath.org/):
for(x=1, 100000, for(y=1, 100000, if(2*x*y-sigma(x*y) >= (2x-sigma(x))*(sigma(y)-y),print(x," ",y))))
However, it is returning the following error message:
*** syntax error, unexpected ')', expecting )-> or ',':
*** ...-sigma(x*y)>=(2x-sigma(x))*(sigma(y)-y),print(
*** ^---------------------
I did already check and verified that all the parentheses are in their proper places. I also checked for missing asterisks and verified that there are none.Thu, 10 Sep 2020 01:11:31 +0200https://ask.sagemath.org/question/53388/i-cannot-seem-to-figure-out-whats-wrong-with-the-following-sage-pari-gp-code/Answer by Jose Arnaldo Bebita Dris for <p>Basically, I would like to search for counterexamples to my conjecture that
$$(2xy - \sigma(xy)) < (2x - \sigma(x))(\sigma(y) - y)$$
where $\sigma$ is the sum of divisors.</p>
<p>I tried using the following Pari-GP script in <a href="https://sagecell.sagemath.org/">Sage Cell Server</a>:</p>
<pre><code>for(x=1, 100000, for(y=1, 100000, if(2*x*y-sigma(x*y) >= (2x-sigma(x))*(sigma(y)-y),print(x," ",y))))
</code></pre>
<p>However, it is returning the following error message:</p>
<pre><code>*** syntax error, unexpected ')', expecting )-> or ',':
*** ...-sigma(x*y)>=(2x-sigma(x))*(sigma(y)-y),print(
*** ^---------------------
</code></pre>
<p>I did already check and verified that all the parentheses are in their proper places. I also checked for missing asterisks and verified that there are none.</p>
https://ask.sagemath.org/question/53388/i-cannot-seem-to-figure-out-whats-wrong-with-the-following-sage-pari-gp-code/?answer=53389#post-id-53389Got it! There was indeed a missing asterisk, after all!
The Pari-GP script should have been coded as such:
for(x=1, 100000, for(y=1, 100000, if(2*x*y-sigma(x*y) >= (2*x-sigma(x))*(sigma(y)-y),print(x," ",y))))
I am able to run this version of the script now.Thu, 10 Sep 2020 01:15:09 +0200https://ask.sagemath.org/question/53388/i-cannot-seem-to-figure-out-whats-wrong-with-the-following-sage-pari-gp-code/?answer=53389#post-id-53389