# Most "compact" sequence such that there is at least one prime between a(n) and a(n+1)

Andrew Plewe aplewe at sbcglobal.net
Tue Dec 11 22:46:45 CET 2007

```On Dec 11, 2007 4:52 PM, Giovanni Resta <g.resta at iit.cnr.it> wrote:
> Now I realize that the sequence you are pursuing is already in OEIS:
> A118085 Number of ways 2 is a product of n superparticular ratios,
> without regard to order. A superparticular ratio is a ratio of the form m/(m-1).
> 1, 1, 5, 43, 876, 49513

Giovanni: well done ; from your observation I noticed that
http://www.research.att.com/~njas/sequences/A085098
should be identical (it's definition is Hugo's one), but the last term
is wrong there, also.

Neil:
1/
http://www.research.att.com/~njas/sequences/A085098 should be marked
as dead, erroneous duplicate of A118085

2/
I don't know what the reference to A118087 (RADD(1,43)) does in
http://www.research.att.com/~njas/sequences/A118087
It does not seem to make any sense to me, I suppose it's there by error.
Also in A118087, it would make more sense to put terms up to a(64)
(end of the 1st period):

%S A118087 1, 44, 87, 121, 164, 504, 448, 887, 831, 181, 224, 465,
607, 749, 990, 142, 284, 525, 568, 908, 852, 301, 146, 684, 529, 968,
912, 262, 305, 546, 688, 929, 972, 322, 266, 705, 550, 98, 132, 274,
515, 558, 898, 941, 192, 334, 476, 717, 760, 110, 54, 88, 131, 174,
514, 458, 897, 841, 191, 234, 475, 617, 759, 1000
%o A118087 (PARI)
A118087(n=64,a=1,b=43)=until(!n--,print1(a",");a=eval(concat(vecextract(Vec(Str(a)),"-1..1")))+b)

2/ can you add my previous comment on the multiset seq to A118085?

%C A118085 Also, number of multisets A={ a_1, ..., a_n } (a_i > 0) such that
P[n](A) = 1+sum( P[i](A), i=1..n-1), where P[i] is the i-th symmetric
polynomial (P[1](A)=sum(a_i), P[n](A)=product(a_i)).

Thanks.
Maximilian

Giovanni Resta <g.resta at iit.cnr.it> wrote:
:hv at crypt.org wrote:
:
:> hv at crypt.org wrote:
:> :%S A000001 1,1,5,43,875,49506
:>
:> Bother, my crude code was cruder than I had realised: both the last two
:> terms are wrong. Corrected terms shown in the copy below. I'm not sure
:> how I'd go about calculating a(7), I'd welcome thoughts on that.
:>
:> %I A000001
:> %S A000001 1,1,5,43,876,49511
:
:Now I realize that the sequence you are pursuing is already in OEIS:
:
:A118085
:Number of ways 2 is a product of n superparticular ratios,
:without regard to order. A superparticular ratio is a ratio of the
:form m/(m-1).
:1, 1, 5, 43, 876, 49513

Thank you, how embarrassing.

I am enumerating them recursively; the only cleverness in the code lies
in calculating the bounds over which to iterate the next set element.

I do this when there are still L terms to include by calculating
p_0 = prod{a_i}, p_1 = prod{a_i+1}, and then get the upper bound as:

(I also more recently added a shortcut when L = 2 and p_1 = k(2 p_0 - p_1)
for some integer k, to iterate over divisors of x directly, but that
wasn't the problem.)

I'm not sure now whether the above is the wrong calculation, or whether
the maths package I'm using (the PARI bindings in perl) simply isn't
accurate enough - I have much more experience dealing with integers
than with reals in calculations - but I find now that if I iterate
to one more than the maximum calculated above I do indeed get a(6)=49513.

I suspect a bit more work would yield a general approach to finding the
number of solutions for (1+1/a_1)(1+1/a_2) = x for arbitrary rational x,
which would at least bring a(7) within range. Reaching a(8) is likely to
need something a bit more radical.

Hugo

```