%I #21 Dec 14 2021 22:33:32
%S 1,3,3,9,9,9,9,9,9,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
%T 27,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,
%U 81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81
%N a(n) is the smallest positive integer m such that the set of numbers {f(k) : 1 <= k <= n} are pairwise distinct modulo m for f(x)=x^3+x.
%C This is called the discriminator of f(x)=x^3+x.
%C First differs from A064235 at n=244.
%H Michel Marcus, <a href="/A349673/b349673.txt">Table of n, a(n) for n = 1..1000</a>
%H Quan-Hui Yang and Lilu Zhao, <a href="https://arxiv.org/abs/2111.11227">On a discriminator for the polynomial f(x)=x^3+x</a>, arXiv:2111.11227 [math.NT], 2021.
%F a(n) = 7*3^(6s+4) if n=3^(6s+5)+1 or n=3^(6s+5)+2; otherwise a(n) = 3^ceiling(log_3(n)) (see Theorem 1.1 in Yang & Zhao).
%t a[n_] := Module[{e1 = IntegerExponent[n-1, 3], e2 = IntegerExponent[n-2, 3], e = -1}, If[3^e1 == n - 1 && Mod[e1,6] == 5, e = e1 - 1]; If[3^e2 == n-2 && Mod[e2,6] == 5, e = e2 - 1];If[e > -1, 7*3^e, 3^Ceiling[Log[3,n]]]]; Array[a, 100] (* _Amiram Eldar_, Nov 24 2021 *)
%o (PARI) isok(n,m) = my(v=vector(n, k, (k^3+k)% m)); #v == #vecsort(v,,8);
%o a(n) = my(m=1); while (!isok(n, m), m++); m;
%o (PARI) a(n) = {my(v); if ((n%3 == 1) && (n!=1), v=valuation(n-1,3); if ((3^v == n-1) && ((v%6)==5), return(7*3^(v-1)))); if ((n%3 == 2) && (n!=2), v=valuation(n-2,3); if ((3^v == n-2) && ((v%6)==5), return(7*3^(v-1)))); return(3^ceil(log(n)/log(3)));}
%Y Cf. A064235.
%K nonn,easy
%O 1,2
%A _Michel Marcus_, Nov 24 2021