# [seqfan] Re: |a-b| divides concatenation [ab]

Jack Brennen jfb at brennen.net
Tue Sep 21 20:12:11 CEST 2010

```PARI program to compute 10,000 terms of T in reasonable time:

/*
Initialize
A : most recent term of sequence
V : vector of entire sequence
S : set of vector elements and differences
*/

A=1; V=; S=Set(V);

/* Do one iteration:  we're looking for N such that
A*10^y+N is congruent to 0 modulo A-N
Equivalently:
A*10^y+A is congruent to 0 modulo A-N
So what we do is enumerate all of the divisors
of A*(10^y+1), assume each one is equal to A-N
or N-A, and choose the smallest N which works
*/

iterate() =
{
y=1;
while(1,L=10^(y-1);H=10^y;G=A*(10^y+1);D=divisors(G);Z=[];
for(j=1,length(D),W=D[j];
if(A-W>=L&&A-W<H,Z=concat(Z,[A-W]));
if(A+W>=L&&A+W<H,Z=concat(Z,[A+W])));
Z=vecsort(Z);
for(k=1,length(Z),T=Z[k];U=abs(A-T);
if(T!=U&&
setsearch(S,T)==0&&
setsearch(S,U)==0,
break(2)));
y+=1);
V=concat(V,[T]);
S=setunion(S,Set([T,U]));
A=T;
}

while(length(V)<10000,iterate();print(length(V),": ",A));

To compute the strictly increasing sequence S, just change one line:

if(T!=U&&

to

if(T>A&&T!=U&&

Note that the sequence T reaches 9 digit numbers fairly quickly,
at index 451, but out to index 12000, it still does not reach
10 digit numbers.

The sequence S (strictly increasing) seems to grow fairly slowly,
with occasional big jumps, which isn't really surprising, I guess.
It reaches 9 digit numbers at index 8060, and then grows very
slowly.

The fact that 9 digit numbers usually get the job done is due to
the relative abundance of divisors of 10^9+1.  (32 divisors)

Note that 10^15+1 has 128 divisors, and so it seems very unlikely
to me that you could ever reasonably calculate the sequence far
enough to the point where 15 digit numbers would not suffice...

```