A350330 Lexicographically earliest sequence of positive integers such that the Hankel matrix of any odd number of consecutive terms is invertible.
1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 3, 2, 2, 1, 1, 2, 2, 3, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 3, 2, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 3, 1
Offset: 1
Keywords
Examples
a(15) = 3, because the Hankel matrix of (a(11), ..., a(15)) is [1 2 1 ] [2 1 2 ] [1 2 a(15)], which is singular if a(15) = 1, and the Hankel matrix of (a(5), ..., a(15)) is [1 2 2 1 2 1 ] [2 2 1 2 1 1 ] [2 1 2 1 1 2 ] [1 2 1 1 2 1 ] [2 1 1 2 1 2 ] [1 1 2 1 2 a(15)], which is singular if a(15) = 2, but if a(15) = 3 the Hankel matrix of (a(k), ..., a(15)) is invertible for all odd k <= 15.
Links
- Robert Israel, Table of n, a(n) for n = 1..1000 (1..400 from _Pontus von Brömssen)
- Wikipedia, Hankel matrix
Programs
-
Python
from sympy import Matrix from itertools import count def A350330_list(nmax): a=[] for n in range(nmax): a.append(next(k for k in count(1) if all(Matrix((n-r)//2+1,(n-r)//2+1,lambda i,j:(a[r:]+[k])[i+j]).det()!=0 for r in range(n-2,-1,-2)))) return a
-
Python
# Faster version using numpy instead of sympy. # Due to floating point errors, the results may be inaccurate for large n. Correctness verified up to n=400 for numpy 1.20.2. from numpy import array from numpy.linalg import det from itertools import count def A350330_list(nmax): a=[] for n in range(nmax): a.append(next(k for k in count(1) if all(abs(det(array([[(a[r:]+[k])[i+j] for j in range((n-r)//2+1)] for i in range((n-r)//2+1)])))>0.5 for r in range(n-2,-1,-2)))) return a
Comments