cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A322144 a(n) = Sum_{i=1..phi(n)-1} (r(i+1)-r(i))^2 where r(1) = 1 < ... < n-1 = r(phi(n)) are the phi(n) integers relatively prime to n.

This page as a plain text file.
%I A322144 #34 Jan 19 2019 03:42:08
%S A322144 0,0,1,4,3,16,5,12,11,24,9,36,11,32,29,28,15,56,17,52,39,48,21,76,31,
%T A322144 56,41,68,27,128,29,60,59,72,57,116,35,80,69,108,39,168,41,100,95,96,
%U A322144 45,156,59,136,89,116,51,176,85,140,99,120,57,260,59,128,125,124,99
%N A322144 a(n) = Sum_{i=1..phi(n)-1} (r(i+1)-r(i))^2 where r(1) = 1 < ... < n-1 = r(phi(n)) are the phi(n) integers relatively prime to n.
%H A322144 David A. Corneth, <a href="/A322144/b322144.txt">Table of n, a(n) for n = 1..10000</a>
%H A322144 Paul Erdos, <a href="https://www.jstor.org/stable/2689842">Some Unconventional Problems in Number Theory</a>, Mathematics Magazine, Vol. 52, No. 2, Mar., 1979, pp. 67-70. See Problem 12. p. 70.
%F A322144 a(p) = p-2, for p prime.
%F A322144 a(k^2 * m) = k * a(k * m) + 4 * (k - 1). - _David A. Corneth_, Nov 28 2018
%e A322144 a(1) and a(2) are 0, since we have an empty sum.
%e A322144 For a(3), the integers < 3, coprime to 3, are 1 and 2, so a(3) = (2-1)^2 = 1.
%t A322144 a[n_] := Total[Differences[Select[Range[n], GCD[n,#]==1 &]]^2]; Array[a, 50] (* _Amiram Eldar_, Nov 28 2018 *)
%o A322144 (PARI) a(n) = {v = select(x->gcd(x,n)==1, vector(n, k, k)); sum(i=1, #v-1, (v[i+1] - v[i])^2);}
%o A322144 (PARI) a(n) = {my(res = 0, io = 1, in = 2); while(in < n, while(gcd(in, n) > 1, in++); res += (in - io)^2; io = in; in++); res}
%o A322144 first(n) = {my(res = vector(n)); for(i = 1, n, c = factorback(factor(i)[, 1]); if(c == i, res[i] = a(i), res[i] = res[c] * (i / c) + 4 * (i / c - 1))); res } \\ _David A. Corneth_, Nov 28 2018
%Y A322144 Cf. A000010 (phi), A038566 (rows of r).
%Y A322144 Cf. A040976 (prime(n)-2), A132952 (isolated totatives).
%K A322144 nonn
%O A322144 1,4
%A A322144 _Michel Marcus_, Nov 28 2018