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-3 of 3 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

A349257 Largest integer that can be expressed as Sum_{k=1..n} k/p(k), where p is a permutation of [n].

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 10, 11, 15, 18, 21, 22, 27, 28, 32, 36, 40, 41, 46, 47
Offset: 0

Views

Author

Seiichi Manyama, Nov 12 2021

Keywords

Crossrefs

Programs

  • Ruby
    def A(n)
      max = 0
      (1..n).to_a.permutation{|i|
        m = (1..n).inject(0){|s, j| s + j / i[j - 1].to_r}
        if m.denominator == 1
          max = m if max < m
        end
      }
      max.to_i
    end
    def A349257(n)
      (0..n).map{|i| A(i)}
    end
    p A349257(8)

Formula

a(n) = 1 + a(n-1) if n is prime. - Alois P. Heinz, Nov 12 2021

Extensions

a(12)-a(19) from Alois P. Heinz, Nov 12 2021

A349277 Triangle T(n,k), n >= 1, 1 <= k <= n, read by rows, where T(n,k) is the number of permutations p of [n] such that Sum_{j=1..n} j/p(j) is an integer and p(n) = k.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 2, 1, 1, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 8, 4, 4, 2, 2, 0, 2, 0, 8, 18, 18, 14, 18, 0, 14, 0, 0, 22, 113, 130, 102, 135, 108, 122, 0, 314, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1128, 1152, 1166, 1130, 1078, 1334, 1182, 0, 1734, 3390, 1226, 0, 1128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14520
Offset: 1

Views

Author

Seiichi Manyama, Nov 12 2021

Keywords

Examples

			Triangle begins:
    1;
    0,   1;
    0,   0,   1;
    1,   0,   0,   1;
    0,   0,   0,   0,   2;
    1,   1,   2,   2,   0,   2;
    0,   0,   0,   0,   0,   0, 8;
    4,   4,   2,   2,   0,   2, 0,   8;
   18,  18,  14,  18,   0,  14, 0,   0, 22;
  113, 130, 102, 135, 108, 122, 0, 314,  0, 104;
    0,   0,   0,   0,   0,   0, 0,   0,  0,   0, 1128;
		

Crossrefs

Row sum gives A073090.

Programs

  • Ruby
    def A(n)
      ary = Array.new(n, 0)
      (1..n).to_a.permutation{|i|
        ary[i[-1] - 1] += 1 if (1..n).inject(0){|s, j| s + j / i[j - 1].to_r}.denominator == 1
      }
      ary
    end
    def A349277(n)
      (1..n).map{|i| A(i)}.flatten
    end
    p A349277(8)

Formula

If n is prime, T(n,k) = 0 for 1 <= k <= n-1.
T(n,n) = A073090(n-1).
Showing 1-3 of 3 results.