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.

A362531 The smallest integer m such that m mod 2k >= k for k = 1, 2, 3, ..., n.

This page as a plain text file.
%I A362531 #26 Jun 22 2023 06:03:42
%S A362531 1,3,3,15,15,47,95,95,287,335,1199,1199,1295,2015,2879,2879,2879,2879,
%T A362531 2879,2879,2879,43199,211679,211679,211679,211679,211679,211679,
%U A362531 211679,211679,3084479,3084479,3084479,3084479,3084479,3084479,302702399,469909439
%N A362531 The smallest integer m such that m mod 2k >= k for k = 1, 2, 3, ..., n.
%C A362531 Take the square array A(k, l) with k= 1, 2, ... and l = 0, 1, ... such that for each k, A(k, l) takes k zeros and then k ones alternately:
%C A362531 0, 1, 0, 1, 0, 1, 0, 1, ...
%C A362531 0, 0, 1, 1, 0, 0, 1, 1, ...
%C A362531 0, 0, 0, 1, 1, 1, 0, 0, ...
%C A362531 ...
%C A362531 Then the a(n)-th column is the first column which begins with n ones.
%H A362531 Tomohiro Yamada, <a href="/A362531/a362531.py.txt">Fast Python program</a>, the original program written by nazratt2.
%e A362531 a(3) = 3 since 3 mod 2 = 1, 3 mod 4 = 3 >= 2, 3 mod 6 = 3 (but 3 mod 8 = 3 < 4) while 1 mod 4 = 1 < 2, 2 mod 2 = 0 < 1.
%o A362531 (PARI) a(n)={my(m);m=1;while(vecmin(vector(n,j,(m%(2*j))/j))<1,m=m+1);m}
%o A362531 (PARI) n=1;for(m=1,10^9,while(vecmin(vector(n,j,(m%(2*j))/j))>=1,print(n," ",m);n=n+1))
%o A362531 (Python)
%o A362531 def A362531(n):
%o A362531     m = 1
%o A362531     while True:
%o A362531         for k in range(n,0,-1):
%o A362531             if (l:=k-m%(k<<1))>0:
%o A362531                 break
%o A362531         else:
%o A362531             return m
%o A362531         m += l # _Chai Wah Wu_, Jun 21 2023
%Y A362531 Cf. A053664.
%K A362531 nonn
%O A362531 1,2
%A A362531 _Tomohiro Yamada_, Apr 24 2023
%E A362531 a(37)-a(38) from _Yifan Xie_, Apr 24 2023