login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Least k such that n+k is squarefree and coprime to n.
2

%I #10 Nov 23 2017 20:18:16

%S 1,1,2,1,1,1,3,3,1,1,2,1,1,1,2,1,2,1,2,1,1,1,3,5,1,3,2,1,1,1,2,1,1,1,

%T 2,1,1,1,2,1,1,1,3,3,1,1,4,5,2,1,2,1,2,1,2,1,1,1,2,1,1,3,2,1,1,1,2,1,

%U 1,1,2,1,1,3,2,1,1,1,3,3,1,1,2,1,1,1,2,1,2,1,2,1,1,1,2,1,4,3,2,1,1,1,2,1,1

%N Least k such that n+k is squarefree and coprime to n.

%C a(n) = A079114(n) - n.

%H Antti Karttunen, <a href="/A079115/b079115.txt">Table of n, a(n) for n = 1..16384</a>

%e From _Michael De Vlieger_, Nov 23 2017: (Start)

%e First positions of values in a(n):

%e n a(n)

%e --------------

%e 1 1

%e 3 2

%e 7 3

%e 47 4

%e 24 5

%e 1679 6

%e 120 7

%e 843 8

%e 2522 9

%e 72471 10

%e 840 11

%e 64050 13

%e 1674274 15

%e 404580 17

%e 2042040 19

%e (End)

%t Table[Block[{k = 1}, While[Nand[SquareFreeQ[n + k], CoprimeQ[n, n + k]], k++]; k], {n, 105}] (* _Michael De Vlieger_, Nov 23 2017 *)

%o (PARI) A079115(n) = { my(k=1); while((!issquarefree(n+k))||(gcd(n,n+k)>1), k++); k; } \\ _Antti Karttunen_, Nov 23 2017

%Y Cf. A005117, A079114.

%K nonn

%O 1,3

%A _Reinhard Zumkeller_, Dec 25 2002