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.

A331503 a(n) is the number of sets modulo n which can be formed by a finite arithmetic sequence.

Original entry on oeis.org

1, 3, 7, 15, 31, 42, 99, 119, 193, 218, 463, 340, 807, 682, 849, 1087, 1939, 1299, 2775, 1862, 2615, 3050, 5107, 2988, 5681, 5242, 6439, 5656, 10615, 5562, 13083, 9631, 11367, 12362, 14153, 10531, 22719, 17578, 19361, 16050, 31243, 16728, 36207, 24284, 26133
Offset: 1

Views

Author

Brian Barsotti, May 03 2020

Keywords

Examples

			For n = 3, the a(3) = 7 solutions are {1}; {2}; {3}; {1,2}; {1,3}; {2,3}; {1,2,3}.
		

Crossrefs

Cf. A000005 (tau), A000203 (sigma).

Programs

  • Mathematica
    Array[#3 + #1 (#2 - 1 - 3 #4 + Sum[#1/GCD[#1, i], {i, #4}]) & @@ Join[{#}, DivisorSigma[{0, 1}, #], {Floor[#/2]}] &, 45] (* Michael De Vlieger, May 04 2020 *)
  • PARI
    a(n) = {sigma(n) + n*(numdiv(n) - 1 - 3*(n\2) + sum(i=1, n\2, n/gcd(n,i)))} \\ Andrew Howroyd, May 03 2020

Formula

a(n) = sigma(n) + n*(tau(n) - 1 - 3*floor(n/2) + Sum_{i=1..floor(n/2)} n/gcd(n,i)).