login
a(n) is the smallest integer k such that n*k mod (n+k) = 1, or -1 if no such k exists.
0

%I #32 Nov 13 2024 13:52:27

%S 1,3,2,13,8,31,3,5,32,91,50,17,4,183,98,241,12,7,162,381,5,75,30,553,

%T 288,651,46,129,392,23,6,9,76,55,578,1261,100,47,722,1561,17,311,7,

%U 105,968,27,18,413,1152,11,1250,489,228,2863,34,3081,8,615,1682,217,1800,707

%N a(n) is the smallest integer k such that n*k mod (n+k) = 1, or -1 if no such k exists.

%F a(a(n)) <= n.

%t sik[n_]:=Module[{k=1},While[Mod[n*k,n+k]!=1,k++];k]; Array[sik,70] (* _Harvey P. Dale_, Aug 15 2015 *)

%o (Python)

%o import math

%o for n in range(1,333):

%o res=-1

%o for k in range(2**31-1):

%o if ((n*k) % (n+k) == 1):

%o res=k

%o break

%o print(res, end=', ')

%o (PARI) a(n) = k=1; while ((n*k) % (n+k) != 1, k++); k; \\ _Michel Marcus_, Jan 08 2015

%Y Cf. A063427.

%K nonn,changed

%O 1,2

%A _Alex Ratushnyak_, Jan 02 2015