

A123565


a(n) = number of positive integers k which are <= n and where k, k1 and k+1 are each coprime to n.


1



1, 0, 0, 0, 2, 0, 4, 0, 0, 0, 8, 0, 10, 0, 0, 0, 14, 0, 16, 0, 0, 0, 20, 0, 10, 0, 0, 0, 26, 0, 28, 0, 0, 0, 8, 0, 34, 0, 0, 0, 38, 0, 40, 0, 0, 0, 44, 0, 28, 0, 0, 0, 50, 0, 16, 0, 0, 0, 56, 0, 58, 0, 0, 0, 20, 0, 64, 0, 0, 0, 68, 0, 70, 0, 0, 0, 32, 0, 76, 0, 0, 0, 80, 0, 28, 0, 0, 0, 86, 0, 40, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,5


COMMENTS

a(p) = p3 for any odd prime p. a(2n) = a(3n) = 0.
a(n) > 0 if and only if n is coprime to 6.  Chai Wah Wu, Aug 26 2016
Also number of pandiagonal Latin squares of order n with fixed first row.  Eduard I. Vatutin, Oct 15 2017
Multiplicative by the Chinese remainder theorem.  Andrew Howroyd, Aug 07 2018


LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
C. Defant, On Arithmetic Functions Related to Iterates of the Schemmel Totient Functions, J. Int. Seq. 18 (2015) # 15.2.1
E. I. Vatutin, Discussion about properties of diagonal Latin squares at forum.boinc.ru (in Russian)
Index entries for sequences related to Latin squares and rectangles


EXAMPLE

The positive integers which are both coprime to 25 and are <= 25 are 1,2,3,4,6,7,8,9,11,12,13,14,16,17,18,19,21,22,23,24. Of these integers there are 10 integers k where (k1) and (k+1) are also coprime to 25. These integers k are 2,3,7,8,12,13,17,18,22,23. So a(25) = 10.
Example of pandiagonal Latin square of order 5:
0 1 2 3 4
2 3 4 0 1
4 0 1 2 3
1 2 3 4 0
3 4 0 1 2
Example of pandiagonal Latin square of order 7:
0 1 2 3 4 5 6
2 3 4 5 6 0 1
4 5 6 0 1 2 3
6 0 1 2 3 4 5
1 2 3 4 5 6 0
3 4 5 6 0 1 2
5 6 0 1 2 3 4


MATHEMATICA

f[n_] := Length[Select[Range[n], GCD[ #, n] == 1 && GCD[ #  1, n] == 1 && GCD[ # + 1, n] == 1 &]]; Table[f[n], {n, 100}] (* Ray Chandler, Nov 19 2006 *)
Join[{1}, Table[Count[Boole[Partition[CoprimeQ[Range[n], n], 3, 1]], {1, 1, 1}], {n, 2, 100}]] (* Harvey P. Dale, Apr 09 2017 *)


PROG

(PARI) a(n)=if(gcd(n, 6)>1, return(0)); sum(k=1, n, gcd(k^3k, n)==1) \\ Charles R Greathouse IV, Aug 26 2016


CROSSREFS

Cf. A058026.
Sequence in context: A087263 A099894 A048298 * A258701 A246160 A081120
Adjacent sequences: A123562 A123563 A123564 * A123566 A123567 A123568


KEYWORD

nonn,mult


AUTHOR

Leroy Quet, Nov 12 2006


EXTENSIONS

Extended by Ray Chandler, Nov 19 2006


STATUS

approved



