Skip to main content
added 8 characters in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 8181 73 bytes

c l@(m:n:_)=m:c([x|x<-[1..],gcd m x<2,gcd n (m*n)x<2,all(/=x)l]!!0:l) ((0:1:c[2,1])!!) 

Usage example: ((0:1:c[2,1])!!) 12-> 17.

Build the list of all a(n), starting with 0 to fix the 1-based index and 1 and followed by c[2,1]. c takes the head of it's argument list l followed by a recursive call with then next number that fits (co-prime, not seen before) added in front of l. Pick the nth element of this list.

Haskell, 81 bytes

c l@(m:n:_)=m:c([x|x<-[1..],gcd m x<2,gcd n x<2,all(/=x)l]!!0:l) ((0:1:c[2,1])!!) 

Usage example: ((0:1:c[2,1])!!) 12-> 17.

Build the list of all a(n), starting with 0 to fix the 1-based index and 1 and followed by c[2,1]. c takes the head of it's argument list l followed by a recursive call with then next number that fits (co-prime, not seen before) added in front of l. Pick the nth element of this list.

Haskell, 81 73 bytes

c l@(m:n:_)=m:c([x|x<-[1..],gcd(m*n)x<2,all(/=x)l]!!0:l) ((0:1:c[2,1])!!) 

Usage example: ((0:1:c[2,1])!!) 12-> 17.

Build the list of all a(n), starting with 0 to fix the 1-based index and 1 and followed by c[2,1]. c takes the head of it's argument list l followed by a recursive call with then next number that fits (co-prime, not seen before) added in front of l. Pick the nth element of this list.

Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 81 bytes

c l@(m:n:_)=m:c([x|x<-[1..],gcd m x<2,gcd n x<2,all(/=x)l]!!0:l) ((0:1:c[2,1])!!) 

Usage example: ((0:1:c[2,1])!!) 12-> 17.

Build the list of all a(n), starting with 0 to fix the 1-based index and 1 and followed by c[2,1]. c takes the head of it's argument list l followed by a recursive call with then next number that fits (co-prime, not seen before) added in front of l. Pick the nth element of this list.