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.

A176774 Smallest polygonality of n = smallest integer m>=3 such that n is m-gonal number.

This page as a plain text file.
%I A176774 #26 Feb 16 2025 08:33:12
%S A176774 3,4,5,3,7,8,4,3,11,5,13,14,3,4,17,7,19,20,3,5,23,9,4,26,10,3,29,11,
%T A176774 31,32,12,7,5,3,37,38,14,8,41,15,43,44,3,9,47,17,4,50,5,10,53,19,3,56,
%U A176774 20,11,59,21,61,62,22,4,8,3,67,68,24,5,71,25,73,74,9,14,77,3,79,80,4,15,83
%N A176774 Smallest polygonality of n = smallest integer m>=3 such that n is m-gonal number.
%C A176774 A176775(n) gives the index of n as a(n)-gonal number.
%C A176774 Since n is the second n-gonal number, a(n) <= n.
%C A176774 Furthermore, a(n)=n iff A176775(n)=2.
%H A176774 Michel Marcus, <a href="/A176774/b176774.txt">Table of n, a(n) for n = 3..10000</a>
%H A176774 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PolygonalNumber.html">Polygonal Number</a>. MathWorld.
%e A176774 a(12) = 5 since 12 is a pentagonal number, but not a square or triangular number. - _Michael B. Porter_, Jul 16 2016
%t A176774 a[n_] := (m = 3; While[Reduce[k >= 1 && n == k (k (m - 2) - m + 4)/2, k, Integers] == False, m++]; m); Table[a[n], {n, 3, 100}] (* _Jean-François Alcover_, Sep 04 2016 *)
%o A176774 (PARI) a(n) = {k=3; while (! ispolygonal(n, k), k++); k;} \\ _Michel Marcus_, Mar 25 2015
%o A176774 (Python)
%o A176774 from __future__ import division
%o A176774 from gmpy2 import isqrt
%o A176774 def A176774(n):
%o A176774     k = (isqrt(8*n+1)-1)//2
%o A176774     while k >= 2:
%o A176774         a, b = divmod(2*(k*(k-2)+n),k*(k-1))
%o A176774         if not b:
%o A176774             return a
%o A176774         k -= 1 # _Chai Wah Wu_, Jul 28 2016
%Y A176774 Cf. A090466, A090467.
%K A176774 nonn
%O A176774 3,1
%A A176774 _Max Alekseyev_, Apr 25 2010