OFFSET
0,6
COMMENTS
a(n) mod 8 = 0.
LINKS
Robert Israel, Table of n, a(n) for n = 0..1000 (terms 0..241 from Indranil Ghosh)
MAPLE
df:= proc(n) local count, c, d, q, av, bc, a, b;
count:= 0:
for d from 1 to n-1 do
av:= {$1..n-1} minus {d};
for q in [-1, 1] do
bc:= n*d+q;
for b in numtheory:-divisors(bc) intersect av do
c:= bc/b;
if c < b and member(c, av) then count:=count+8 fi;
od od od;
count
end proc:
ListTools:-PartialSums(map(df, [$0..100])); # Robert Israel, Nov 29 2016
MATHEMATICA
df[n_] := Module[{count = 0, c, d, q, av, bc, a, b}, Do[av = Range[n - 1] ~Complement~ {d}; Do[bc = n d + q; Do[c = bc/b; If[c < b && MemberQ[av, c], count += 8], {b, Divisors[bc] ~Intersection~ av}], {q, {-1 , 1}}], {d, 1, n - 1}]; count];
df /@ Range[0, 100] // Accumulate (* Jean-François Alcover, Jul 29 2020, after Robert Israel *)
PROG
(Python)
def a(n):
s=0
for a in range(0, n+1):
for b in range(0, n+1):
for c in range(0, n+1):
for d in range(0, n+1):
if (a!=b and a!=d and b!=d and c!=a and c!=b and c!=d):
if abs(a*d-b*c)==1:
s+=1
return s
print([a(n) for n in range(0, 52)]) # Indranil Ghosh, Nov 29 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Indranil Ghosh, Nov 29 2016
STATUS
approved