Sequences based on algorithms

Olivier Gerard olivier.gerard at gmail.com
Wed Nov 14 12:30:35 CET 2007


On Nov 13, 2007 5:39 PM, Andrew Plewe <aplewe at sbcglobal.net> wrote:
> This is an area I'm starting to explore; do you think sequences based on
> algorithms/functions are acceptable for inclusion in the OEIS? For instance,
> here's a sequenced based on PARI's "nextprime" and "sqrtint" functions:
>
The case you give can be interpreted as a mathematical property of
integers and the difficulties in its precise definition are of the same
kind than those for other mathematical functions or concepts such
as the totient number or the very notion of prime itself (with 1 in
a particular status, etc)

>
>
> However, I'm not sure if the "nextprime" function in PARI is the same as,
> say, the "nextprime" function in Mathematica, or in some other context. In
> PARI, for instance, "nextprime" will check if the starting value itself is
> prime and, if it is, will return that value. Other implementations may not
> check the starting value to see if it's prime, in which case squares of
> primes would be excluded from this sequence. The same issue exists for the
> "sqrtint" function; I believe PARI always rounds down, while the rounding
> scheme in other versions may be different.
>
This is indeed the case, the NextPrime function of Mathematica, which is
new in version 6, is the next prime *above* the argument, so has not the
same behavior than the one chosen in Pari. For the same environment,
you have to construct
yourself sqrtint, so you have to choose between Floor, Round and Ceiling.

> The sequence is of interest to me and well-defined, but I hesitate to submit
> it (after finding more terms) because of potential differences between
> implementations of the "nextprime" function and the "sqrtint" function.
>
Neil, who is the authority on the subject, has already answered your
concern and by the way here are the results of using Mathematica
convention (but rounding down square roots as you did) :

14, 15, 21, 22, 33, 35, 55, 65, 77, 85, 91, 119, 133, 143, 161, 187, \
203, 209, 221, 247, 253, 299, 319, 323, 341, 377, 391, 403, 407, 437, \
481, 493, 527, 551, 589, 629, 667, 697, 703, 713, 731, 779, 799, 851, \
899, 901, 943, 989, 1073, 1081, 1147, 1189, 1219, 1247, 1271, 1333, \
1357, 1363, 1457, 1517, 1537, 1591, 1643, 1711, 1739, 1763, 1769

As you anticipated, square roots are not present but a few other numbers
appear as balanced while they were not in your sequence.

sqrt(21)=4.58...

21 = (3 * 7) = mmanextprime(4-2)*mmanextprime(4+2)

would be impossible in your case since 2 is prime.

So the answer of Neil would probably be: let both sequence be
in the OEIS.


Olivier





More information about the SeqFan mailing list