Do any integers occur in both sequences?

Peter Pein petsie at dordos.net
Tue Jul 31 04:32:57 CEST 2007


Leroy Quet schrieb:
> I have just submitted these two interdependent sequences (So don't look 
> for them in the database yet):
> 
>> %I A131937
>> %S A131937 1,4,8,14,21,29,38,49,61
>> %N A131937 a(1)=1; a(2)=4. a(n) = a(n-1) + (nth positive integer which 
>> does not occur in sequence A131938).
>> %e A131937 A131938: 2,5,10,16,23,32,42,53,...
>> Positive integers not in A131938: 1,3,4,6,7,8,9,11,...
>> So A131937(8) = A131937(7) + 11 = 49.
>> %Y A131937 A131938
>> %O A131937 1
>> %K A131937 ,more,nonn,
> 
>> %I A131938
>> %S A131938 2,5,10,16,23,32,42,53,65,78,93,109
>> %N A131938 a(1)=2; a(2)=5. a(n) = a(n-1) + (nth positive integer which 
>> does not occur in sequence A131937).
>> %e A131938 A131937: 1,4,8,14,21,29,...
>> Positive integers not in A131937: 2,3,5,6,7,9,10,11,...
>> So A131938(8) = A131938(7) + 11 = 53.
>> %Y A131938 A131937
>> %O A131938 1
>> %K A131938 ,more,nonn,
> 
> 
> I have not thought about this too hard; so for all I know, the proof is 
> quite easy.
> 
> Do any positive integers occur in both A131937 and A131938?
> 
> Thanks,
> Leroy Quet
> 

Hello Leroy,

let's just do the first step (n=3) to extend these lists:
(let A131937=:l1 and A131938=:l2)

I get
Complement[posint, l2]={1,3,4,6,7,8,9,...}
Therefore the third positive integer which is not in l2 is 4 again and
l1 starts {1, 4, 4, 6, 8, 10, 12}
and l2 begins {2, 5, 5, 7, 9, 11, 13}

The Mma-Code and its output:

each "grouped output" consists of l1 & l2 so far, n followed by the
complement of (the begin of) N w.r.t. l2 and l1 resp.; you can count the
elements using the latter.

In[26]:=
list1={1,4};list2={2,5};n=3;
Do[
    Print[{list1,list2}];
    Print[n," ",Complement[Range[15],#]&/@{list2,list1}];
    AppendTo[list1,Part[Complement[Range[n+Length[list2]],list2],n]];
    AppendTo[list2,Part[Complement[Range[n+Length[list1]],list1],n]];
    n++;
    ,{5}];
list1
list2
Intersection[%%,%]

 From In[26]:=
{{1,4},{2,5}}
 From In[26]:=
3 {{1,3,4,6,7,8,9,10,11,12,13,14,15},
   {2,3,5,6,7,8,9,10,11,12,13,14,15}}
 From In[26]:=
{{1,4,4},{2,5,5}}
 From In[26]:=
4 {{1,3,4,6,7,8,9,10,11,12,13,14,15},
   {2,3,5,6,7,8,9,10,11,12,13,14,15}}
 From In[26]:=
{{1,4,4,6},{2,5,5,7}}
 From In[26]:=
5 {{1,3,4,6,8,9,10,11,12,13,14,15},
   {2,3,5,7,8,9,10,11,12,13,14,15}}
 From In[26]:=
{{1,4,4,6,8},{2,5,5,7,9}}
 From In[26]:=
6 {{1,3,4,6,8,10,11,12,13,14,15},
   {2,3,5,7,9,10,11,12,13,14,15}}
 From In[26]:=
{{1,4,4,6,8,10},{2,5,5,7,9,11}}
 From In[26]:=
7 {{1,3,4,6,8,10,12,13,14,15},
   {2,3,5,7,9,11,12,13,14,15}}
Out[28]= (* A131937 *)
{1,4,4,6,8,10,12}
Out[29]= (* A131938 *)
{2,5,5,7,9,11,13}
Out[30]= (* intersection *)
{}

These are the first elements of l1 and l2 after 100 iterations:

{1,4,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,\
54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,\
104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,\
142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,\
180,182,184,186,188,190,192,194,196,198,200,202}

{2,5,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,\
55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,\
105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,\
143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,\
181,183,185,187,189,191,193,195,197,199,201,203}

and the intersection is empty.

Looks like the algorithm separates odd and even numbers.

Because the algorithm is very inefficient, I've chosen 10^4 as maximum
number of iterations:

list1={1,4};list2={2,5};n=3;
Do[
    AppendTo[list1,Part[Complement[Range[n+Length[list2]],list2],n]];
    AppendTo[list2,Part[Complement[Range[n+Length[list1]],list1],n]];
    n++;
    ,{10^4}];
Intersection[list1,list2]

--> {}

and the lists (almost) are the evens and the odds:

Take[#,-5]&/@{list1,list2}
{{19994,19996,19998,20000,20002},{19995,19997,19999,20001,20003}}

I guess, something went wrong in your definition or in my algorithm.


Best regards,
Peter





More information about the SeqFan mailing list