OFFSET
1,2
COMMENTS
Conjecture: a(n)=n^2 if and only if n is squarefree. [Ben Branman, Mar 22 2013]
Preceding conjecture is true in the case where n is squarefree. - Eric M. Schmidt, Mar 23 2013
It appears that a(p^k) = (1+3*p^2 + 2*k*(p^2-1) + (-1)^k*(p^2-1))*p^(2*k-2)/4 for primes p. Since the sequence is multiplicative, this would imply the conjecture. - Robert Israel, Jun 10 2015
A proof of the formula for k=1 can be done easily (see pdf). - Manfred Scheucher, Jun 10 2015
LINKS
Manfred Scheucher, Table of n, a(n) for n = 1..1000
Manfred Scheucher, A proof of the formula for k=1
MAPLE
f:= proc(n)
local tot, S, a, mult, sa, d, ad, g, cands;
tot:= 0;
S:= ListTools:-Classify(t -> t^2 mod n, [$0..n-1]);
for a in numtheory:-divisors(n) do
mult:= numtheory:-phi(n/a);
sa:= a^2 mod n;
for d in S[sa] do
g:= igcd(a+d, n);
cands:= [seq(i*n/g, i=0..g-1)];
tot:= tot + mult * numboccur(sa, [seq(seq(s*t, s=cands), t=cands)] mod n);
od
od;
tot
end proc:
map(f, [$1..100]); # Robert Israel, Jun 09 2015
MATHEMATICA
a[m_] := Count[Table[Mod[MatrixPower[Partition[IntegerDigits[n, m, 4], 2], 2], m] == {{0, 0}, {0, 0}}, {n, 0, m^4 - 1}], True]; Table[a[n], {n, 2, 30}] (* Ben Branman, Mar 22 2013 *)
PROG
(C)
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char** argv)
{
long ct = 0;
int n = atoi(argv[1]);
int a, b, c, d;
for(a=0; a<n; a++)
{
for(b=0; b<n; b++)
{
for(c=0; c<n; c++)
{
if((a*a+b*c)%n != 0) continue;
for(d=0; d<n; d++)
{
if((b*c+d*d)%n != 0) continue;
if((a*b+b*d)%n != 0) continue;
if((c*a+d*c)%n != 0) continue;
ct++;
}
}
}
}
printf("%d %ld\n", n, ct);
return 0;
}
/* Manfred Scheucher, Jun 09 2015 */
CROSSREFS
KEYWORD
mult,nonn
AUTHOR
Yuval Dekel (dekelyuval(AT)hotmail.com), Sep 28 2003
EXTENSIONS
More terms from Ben Branman, Mar 22 2013
More terms from Manfred Scheucher, Jun 09 2015
STATUS
approved