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.

Showing 1-2 of 2 results.

A349145 Number of ordered n-tuples (x_1, x_2, x_3, ..., x_n) such that Sum_{k=1..n} k/x_k is an integer and x_k is an integer between 1 and n for 1 <= k <= n.

Original entry on oeis.org

1, 1, 2, 8, 43, 207, 2391, 15539, 182078, 2070189, 35850460, 338695058, 10609401552, 115445915555
Offset: 0

Views

Author

Seiichi Manyama, Nov 08 2021

Keywords

Examples

			1/1 + 2/1 = 3 and 3 is an integer.
1/1 + 2/2 = 2 and 2 is an integer.
1/2 + 2/1 = 5/2.
1/2 + 2/2 = 3/2.
So a(2) = 2.
		

Crossrefs

Programs

  • Python
    from fractions import Fraction
    from itertools import product
    def A349145(n): return sum(1 for d in product(range(1,n+1),repeat=n) if sum(Fraction(i+1,j) for i, j in enumerate(d)).denominator == 1) # Chai Wah Wu, Nov 09 2021
  • Ruby
    def A(n)
      return 1 if n == 0
      cnt = 0
      (1..n).to_a.repeated_permutation(n){|i|
        cnt += 1 if (1..n).inject(0){|s, j| s + j / i[j - 1].to_r}.denominator == 1
      }
      cnt
    end
    def A349145(n)
      (0..n).map{|i| A(i)}
    end
    p A349145(6)
    

Extensions

a(10)-a(13) from Alois P. Heinz, Nov 08 2021

A349148 Number of unordered n-tuples {x_1, x_2, x_3, ..., x_n} such that Sum_{k=1..n} 1/x_k is an integer and x_k is an integer between 1 and n for 1 <= k <= n.

Original entry on oeis.org

1, 1, 2, 3, 6, 9, 25, 39, 84, 158, 381, 610, 2175, 3489, 7252, 24744, 54658, 89031, 273604, 443746, 1690517, 5261990, 9399018, 15470605, 58261863, 102574465
Offset: 0

Views

Author

Seiichi Manyama, Nov 08 2021

Keywords

Examples

			1/1 + 1/1 = 2 and 2 is an integer.
1/1 + 1/2 = 3/2.
1/2 + 1/2 = 1 and 1 is an integer.
So a(2) = 2.
		

Crossrefs

Cf. A349146.

Programs

  • Python
    from math import lcm
    from itertools import combinations_with_replacement
    def A349148(n):
        k = lcm(*range(2,n+1))
        dlist = (k//d for d in range(1,n+1))
        return sum(1 for d in combinations_with_replacement(dlist,n) if sum(d) % k == 0) # Chai Wah Wu, Nov 09 2021
  • Ruby
    def A(n)
      return 1 if n == 0
      cnt = 0
      (1..n).to_a.repeated_combination(n){|i|
        cnt += 1 if (1..n).inject(0){|s, j| s + 1 / i[j - 1].to_r}.denominator == 1
      }
      cnt
    end
    def A349148(n)
      (0..n).map{|i| A(i)}
    end
    p A349148(10)
    

Extensions

a(16)-a(25) from Alois P. Heinz, Nov 08 2021
Showing 1-2 of 2 results.