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.

A309914 Distance from n to closest triangular number that is different from n.

This page as a plain text file.
%I A309914 #5 Aug 23 2019 14:10:26
%S A309914 1,1,1,2,1,1,3,1,2,1,4,1,2,2,1,5,1,2,3,2,1,6,1,2,3,3,2,1,7,1,2,3,4,3,
%T A309914 2,1,8,1,2,3,4,4,3,2,1,9,1,2,3,4,5,4,3,2,1,10,1,2,3,4,5,5,4,3,2,1,11,
%U A309914 1,2,3,4,5,6,5,4,3,2,1,12,1,2,3,4,5,6,6,5,4,3,2,1,13,1,2,3,4,5,6,7,6,5
%N A309914 Distance from n to closest triangular number that is different from n.
%H A309914 <a href="/index/Di#distance_to_the_nearest">Index entries for sequences related to distance to nearest element of some set</a>
%t A309914 a[n_] := Module[{k = 1}, While[! IntegerQ[Sqrt[8 (n + k) + 1]] && ! IntegerQ[Sqrt[8 (n - k) + 1]], k++]; k]; Table[a[n], {n, 0, 100}]
%Y A309914 Cf. A000217, A053188, A053616, A066635.
%K A309914 nonn
%O A309914 0,4
%A A309914 _Ilya Gutkovskiy_, Aug 22 2019