This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A319813 #8 Oct 03 2018 10:37:38 %S A319813 1,1,2,0,4,0,6,0,2,3,10,0,12,0,14,0,16,0,18,0,5,0,22,0,4,5,2,0,28,0, %T A319813 30,0,32,13,34,0,36,0,17,0,40,0,42,0,14,0,46,0,6,3,50,0,52,0,19,0,8, %U A319813 17,58,0,60,0,5,0,64,0,66,0,68,0,70,0,72,31,14,0,76 %N A319813 a(n) is the smallest a such that n is divisible by a^n + 1, or 0 if no such a exists. %C A319813 a(n) = 0 iff n is even and -1 is not a square modulo n, that is, n is even and not in A008784. For other n > 2, 2 <= a(n) <= n - 1. %C A319813 a(p) = p - 1 for primes p. For composite n, a(n) = n - 1 iff gcd(n, phi(n)) = 1, that is, n is in A050384. %C A319813 a(A006521(n)) = 2. %H A319813 Jianing Song, <a href="/A319813/b319813.txt">Table of n, a(n) for n = 1..7000</a> %F A319813 For n = 9, 9 is divisible by a^9 + 1 implies a == 2 (mod 3), so a(9) = 2. %F A319813 For n = 10, 10 is divisible by a^10 + 1 implies a == 3, 7 (mod 10), so a(10) = 3. %F A319813 For n = 34, 34 is divisible by a^34 + 1 implies a == 13, 21 (mod 34), so a(34) = 13. %o A319813 (PARI) a(n) = if(!(n%2)&&!issquare(Mod(-1,n)), 0, my(i=1); while(Mod(i,n)^n!=n-1, i++); i) %Y A319813 Cf. A074792 (a^n - 1 instead of a^n + 1). %Y A319813 Cf. also A006521, A008784, A050384. %K A319813 nonn %O A319813 1,3 %A A319813 _Jianing Song_, Sep 28 2018