login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A247665 a(1)=2; thereafter a(n) is the smallest number not yet used which is compatible with the condition that a(n) is relatively prime to the next n terms. 23

%I

%S 2,3,4,5,7,9,8,11,13,17,19,23,15,29,14,31,37,41,43,47,53,59,61,67,71,

%T 73,25,27,79,83,16,49,89,97,101,103,107,109,113,121,127,131,137,139,

%U 149,151,157,163,167,169,173,179,181,191,85,193,57,197,199,211,223

%N a(1)=2; thereafter a(n) is the smallest number not yet used which is compatible with the condition that a(n) is relatively prime to the next n terms.

%C It appears that a(k) is even iff k = 2^i-1 (cf. A248379). It also appears that all powers of 2 occur in the sequence. (_Amarnath Murthy_)

%C The indices of even terms and their values are [1, 2], [3, 4], [7, 8], [15, 14], [31, 16], [63, 32], [127, 64], [255, 128], [511, 122], ...

%C Will the numbers 6, 10, 21, 22, ... ever occur? 12, 18, 20, ... are also missing, but if 6 never appears then neither will 12, etc.

%C A related question: are all terms deficient? - _Peter Munn_, Jul 20 2017

%D _Amarnath Murthy_, Email to _N. J. A. Sloane_, Oct 05 2014.

%H Russ Cox, <a href="/A247665/b247665.txt">Table of n, a(n) for n = 1..100000</a>

%H Russ Cox, <a href="/A247665/a247665.go.txt">Go program</a> (can compute 5 million terms in about 5 minutes)

%H Russ Cox, <a href="/A247665/a247665.txt">Table of n, a(n) for n = 1..203299677, composite a(n) only</a>; a(203299678) > 2^32.

%e a(1) = 2 must be rel. prime to a(2), so a(2)=3.

%e a(2) = 3 must be rel. prime to a(3) and a(4), so we can take them to be 4 and 5.

%e a(3) = 4 must be rel. prime to a(5), a(6), so we must take them to be 7,9.

%e a(4) = 5 must be rel. prime to a(7), a(8), so we must take them to be 8,11.

%e At each step after the first, we must choose two new numbers, and we must make sure that not only are they rel. prime to a(n), they are also rel. prime to all a(i), i>n, that have been already chosen.

%o (PARI) m=100; v=vector(m); u=vectorsmall(100*m); for(n=1, m, for(i=2, 10^9, if(!u[i], for(j=(n+1)\2, n-1, if(gcd(v[j], i)>1, next(2))); v[n]=i; u[i]=1; break))); v \\ _Jens Kruse Andersen_, Oct 08 2014

%o (Haskell)

%o a247665 n = a247665_list !! (n-1)

%o a247665_list = 2 : 3 : f [3] [4..] where

%o f (x:xs) zs = ys ++ f (xs ++ ys) (zs \\ ys) where

%o ys = [v, head [w | w <- vs, gcd v w == 1]]

%o (v:vs) = filter (\u -> gcd u x == 1 && all ((== 1) . (gcd u)) xs) zs

%o -- _Reinhard Zumkeller_, Oct 09 2014

%o (Sage)

%o # s is the starting point (2 in A247665).

%o def gen(s):

%o sequence = [s]

%o available = range(2,2*s)

%o available.pop(available.index(s))

%o yield s

%o while True:

%o available.extend(range(available[-1]+1,next_prime(available[-1])+1))

%o for i,e in enumerate(available):

%o if all([gcd(e, sequence[j])==1 for j in range(-len(sequence)/2,0)]):

%o available.pop(i)

%o sequence.append(e)

%o yield(e)

%o break

%o g = gen(2)

%o [g.next() for i in range(40)] (gets first 40 terms of A247665)

%o # _Nadia Heninger_, Oct 28 2014

%Y Cf. A248379, A248381, A248388, A248389, A248390, A248391, A249049, A249050, A249058, A249556.

%Y Indices of primes and prime powers: A248387, A248918.

%Y Lengths of runs of primes: A249033.

%Y A090252 = similar to A247665 but start with a(1)=1. A249559 starts with a(1)=3.

%Y A249064 is a different generalization.

%Y A064413 is another similar sequence.

%K nonn,look

%O 1,1

%A _N. J. A. Sloane_, Oct 06 2014 and Oct 08 2014

%E More terms from _Jens Kruse Andersen_, Oct 06 2014

%E Further terms from _Russ Cox_, Oct 08 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 22 08:23 EDT 2018. Contains 315270 sequences. (Running on oeis4.)