OFFSET
0,2
COMMENTS
The number of distinct sums of reciprocals is given by A212606.
LINKS
Dexter Senft, Table of n, a(n) for n = 0..36
PROG
(C#)
/* For n=43 or greater, the least common multiple of the numbers 1..n requires more than 64 bits to represent, and C# has no such native data type. */
using System;
using System.Collections.Generic;
namespace A212658 {
class Program {
static long Result;
static long GCD(long n, long m) {
long mod;
long j = n<m ? m : n;
long k = n<m ? n : m;
while (true) if ((mod = k%j) == 0)
return j; else { k=j; j=mod; }
}
static long LCM(int n) { // This produces A003418
return n<=1 ? 1 : LCM(n-1) / GCD(LCM(n-1), n) * n;
}
static void Main(string[] args) {
List<long> numbers = new List<long>();
for (int n=1; n<=42; n++) {
long lcm= LCM(n);
numbers.Clear();
Result = 0;
for (int i=2; i<=n; i++) numbers.Add(lcm/i);
Count(lcm, numbers, 0);
Console.Write(n.ToString() + ": " + (Result+2).ToString() + "\n");
}
}
static void Count(long Target, List<long> L, int At) {
if (At >= L.Count) return;
if (L[At] <= Target) {
Result++;
long AmtLeft = Target - L[At];
if (AmtLeft >= L[L.Count-1]) Count(AmtLeft, L, At);
}
Count(Target, L, At+1);
return;
}
}
}
/* Dexter Senft, Feb 07 2019 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Max Alekseyev, May 23 2012
EXTENSIONS
a(24)-a(25) from Alois P. Heinz, Nov 20 2017
a(26)-a(31) from Dexter Senft, Feb 07 2019
STATUS
approved