login
Number of triples (x,x+1,x+2) with 1 < x <= p-3 of consecutive integers less than p whose product is 1 modulo p, where p = prime(n).
3

%I #29 Apr 06 2015 04:21:10

%S 0,0,0,1,1,0,1,1,2,0,0,1,0,1,0,1,3,1,1,0,0,1,1,1,1,3,1,1,1,1,0,0,1,0,

%T 1,0,1,0,3,3,0,1,1,0,0,1,3,3,1,1,0,0,1,1,0,1,0,3,0,1,1,1,3,0,1,3,0,1,

%U 3,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,3,1,0,3,1,1,0,0,0,1,0,1,1,0,0,1,1,1,1,0,0,3,3,0,3,1,1,1,1,1,1,0,0,1,1,0,1,0,3,1,1,3,1,1,0,1,1,1,0,1,1,1,1,3,0,3,0,1,3,1,3,0,0,0,3,1,3,0,1,1,1,0,1,1,0,1,0,1,1,1,3,3

%N Number of triples (x,x+1,x+2) with 1 < x <= p-3 of consecutive integers less than p whose product is 1 modulo p, where p = prime(n).

%C Is 23 the only prime with two triples?

%H Marian Kraus, <a href="/A256572/b256572.txt">Table of n, a(n) for n = 1..9592</a>

%F |T| where T={x|x*(x+1)*(x+2)==1 (mod p), p is prime, 1<x<=p-3}.

%e For p=7: 4*5*6==1 (mod 7); T={4}, |T|=1.

%e For p=23: 2*3*4==1 (mod 23) and 9*10*11==1 (mod 23); T={2,9}, |T|=2.

%e For p=59: 3*4*5==1 (mod 59), 12*13*14==1 (mod 59), and 41*42*43==1 (mod 59); T={3,12,41}, |T|=3.

%o (R)

%o library(numbers);IP <- vector();t <- vector();S <- vector();IP <- c(Primes(1000));LIP <- length(IP);for (j in 1:LIP){for (i in (3:(IP[j]-2))){t[i-1] <- as.vector(mod(((i-1)*i*(i+1)),IP[j]))};S[j] <- length(which(t==1))};S

%o #Needs a lot of memory. For Primes(100000), this takes a few hours.

%o (PARI) a(n) = {my(p = prime(n)); sum(x=2, p-3, (x*(x+1)*(x+2)) % p == 1);} \\ _Michel Marcus_, Apr 03 2015

%Y Cf. A256567.

%K nonn

%O 1,9

%A _Marian Kraus_, Apr 02 2015