# Integer sequence and RAM limits [closed]

I am trying to calculate the set of unique differences in a sequence, however the sequence grows fast and I hit the RAM limit of my PC for nthPrimeToUse = 11. For nthPrimeToUse 1 to 10 the output of Length[abc4] is: 0,1,2,3,5,7,10,13,16,20,... I am trying to find at least a few more terms if possible. Here is the code:

Updated code: (outputs: 0,1,2,3,5,7,10,13,16,20 for nthPrimeToUse=1 to 10)

nthPrimeToUse = 5;
Primorial[n_] := Times @@ Prime[Range[n]]
PrimorialToUse = Primorial[nthPrimeToUse - 1];
x = Select[(primeNumber) Range@range, GCD[#, PrimorialToUse ] == 1 &];
valuesDivisibleByPrime = {}
For[i = 0, i < Length[x], i++,
AppendTo[valuesDivisibleByPrime, x[[i]]]
]
]
x = Differences[valuesDivisibleByPrime] ;
CountDistinct[x]


This code is faster, possibly equivalent to the above code for nthPrimeToUse > 3 (outputs: 0,0,1,3,5,7,10,13,16,20 for nthPrimeToUse=1 to 10)

nthPrimeToUse = 5;
Primorial[n_] := Times @@ Prime[Range[n]]
PrimorialToUse = Primorial[nthPrimeToUse - 1];

coprimesOfPrimorial =
Select[Range[1, PrimorialToUse], CoprimeQ[PrimorialToUse, #] &];
abc1 = Length[coprimesOfPrimorial];
abc2 = Differences[coprimesOfPrimorial];
abc3 = CountDistinct[abc2];
abc4 = DeleteDuplicates[abc2];

• When I execute your code I get the sequence $\{0, 0, 1, 3, 5, 7, 10, 13, 16,\ldots\}$. What are the correct values for $n=1,2,3$? – Roman Jul 6 '19 at 12:35