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-5 of 5 results.

A177025 Number of ways to represent n as a polygonal number.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 3, 2, 1, 2, 1, 1, 3, 2, 1, 2, 2, 1, 2, 3, 1, 2, 1, 1, 2, 2, 2, 4, 1, 1, 2, 2, 1, 2, 1, 1, 4, 2, 1, 2, 2, 1, 3, 2, 1, 2, 3, 1, 2, 2, 1, 2, 1, 1, 2, 3, 2, 4, 1, 1, 2, 3, 1, 2, 1, 1, 3, 2, 1, 3, 1, 1, 4, 2, 1, 2, 2, 1, 2, 2, 1, 2, 3, 2, 2, 2, 2, 3, 1, 1, 2, 3
Offset: 3

Views

Author

Vladimir Shevelev, May 01 2010

Keywords

Comments

Frequency of n in the array A139601 or A086270 of polygonal numbers.
Since n is always n-gonal number, a(n) >= 1.
Conjecture: Every positive integer appears in the sequence.
Records of 2, 3, 4, 5, ... are reached at n = 6, 15, 36, 225, 561, 1225, ... see A063778. [R. J. Mathar, Aug 15 2010]

References

  • J. J. Tattersall, Elementary Number Theory in Nine chapters, 2nd ed (2005), Cambridge Univ. Press, page 22 Problem 26, citing Wertheim (1897)

Crossrefs

Programs

  • Maple
    A177025 := proc(p)
        local ii,a,n,s,m ;
        ii := 2*p ;
        a := 0 ;
        for n in numtheory[divisors](ii) do
            if n > 2 then
                s := ii/n ;
                if (s-2) mod (n-1) = 0 then
                    a := a+1 ;
                end if;
            end if;
        end do:
        return a;
    end proc: # R. J. Mathar, Jan 10 2013
  • Mathematica
    nn = 100; t = Table[0, {nn}]; Do[k = 2; While[p = k*((n - 2) k - (n - 4))/2; p <= nn, t[[p]]++; k++], {n, 3, nn}]; t (* T. D. Noe, Apr 13 2011 *)
    Table[Length[Intersection[Divisors[2 n - 2] + 1, Divisors[2 n]]] - 1, {n, 3, 100}] (* Jonathan Sondow, May 09 2014 *)
  • PARI
    a(n) = sum(i=3, n, ispolygonal(n, i)); \\ Michel Marcus, Jul 08 2014
    
  • Python
    from sympy import divisors
    def a(n):
        i=2*n
        x=0
        for d in divisors(i):
            if d>2:
                s=i/d
                if (s - 2)%(d - 1)==0: x+=1
        return x # Indranil Ghosh, Apr 28 2017, translated from Maple code by R. J. Mathar

Formula

a(n) = A129654(n) - 1.
G.f.: x * Sum_{k>=2} x^k / (1 - x^(k*(k + 1)/2)) (conjecture). - Ilya Gutkovskiy, Apr 09 2020

Extensions

Extended by R. J. Mathar, Aug 15 2010

A177029 Numbers that have exactly two different representations as polygonal numbers.

Original entry on oeis.org

6, 9, 10, 12, 16, 18, 22, 24, 25, 27, 30, 33, 34, 35, 39, 40, 42, 46, 48, 49, 52, 54, 57, 58, 60, 63, 65, 69, 72, 76, 82, 84, 85, 87, 88, 90, 92, 93, 94, 95, 99, 102, 106, 108, 114, 115, 118, 121, 123, 124, 125, 129, 130, 132, 133, 138, 142, 147, 150, 155, 159, 160, 162, 166, 168
Offset: 1

Views

Author

Vladimir Shevelev, May 01 2010

Keywords

Comments

Numbers that have only A177025(.)=1 representation are listed by A090467.

Examples

			6 is a triangular and a hexagonal number, but is not any other k-gonal number.
		

Crossrefs

Programs

  • PARI
    lista(nn) = {for (n=1, nn, if (sum(k=3, n, ispolygonal(n, k)) == 2, print1(n, ", ")););} \\ Michel Marcus, Mar 25 2015
    
  • Python
    A177029_list = []
    for m in range(1,10**4):
        n, c = 3, 0
        while n*(n+1) <= 2*m:
            if not 2*(n*(n-2) + m) % (n*(n - 1)):
                c += 1
                if c > 1:
                    break
            n += 1
        if c == 1:
            A177029_list.append(m) # Chai Wah Wu, Jul 28 2016

Formula

{m: A177025(m)=2}.

Extensions

Extended by R. J. Mathar, Aug 15 2010

A176948 a(n) is the smallest solution x to A176774(x)=n; a(n)=0 if this equation has no solution.

Original entry on oeis.org

3, 4, 5, 0, 7, 8, 24, 27, 11, 33, 13, 14, 42, 88, 17, 165, 19, 20, 60, 63, 23, 69, 72, 26, 255, 160, 29, 87, 31, 32, 315, 99, 102, 208, 37, 38, 114, 805, 41, 123, 43, 44, 132, 268, 47, 696, 475, 50, 150, 304, 53, 159, 162, 56, 168, 340, 59, 177, 61, 62, 615, 1309, 192, 388
Offset: 3

Views

Author

Vladimir Shevelev, Apr 29 2010

Keywords

Comments

A greedy inverse function to A176774.
Conjecture: For every n >= 4, except for n=6, there exists an n-gonal number N which is not k-gonal for 3 <= k < n.
This means that the sequence contains only one 0: a(6)=0. For n=6 it is easy to prove that every hexagonal number (A000384) is also triangular (A000217), i.e., N does not exist. - Vladimir Shevelev, Apr 30 2010

Examples

			For n=9, 24 is a nonagonal number, but not an octagonal number, heptagonal number, hexagonal number, etc. The smaller nonagonal number 9 is also a square number. Thus, a(9) = 24. - _Michael B. Porter_, Jul 16 2016
		

Crossrefs

Programs

  • Maple
    A139601 := proc(k,n) option remember ; n/2*( (k-2)*n-k+4) ; end proc:
    A176774 := proc(n) option remember ; local k,m,pol ; for k from 3 do for m from 0 do pol := A139601(k,m) ; if pol = n then return k ; elif pol > n then break; end if; end do: end do: end proc:
    A176948 := proc(n) if n = 6 then 0; else for x from 3 do if A176774(x)= n then return x ; end if; end do: end if; end proc:
    seq(A176948(n),n=3..80) ; # R. J. Mathar, May 03 2010
  • Mathematica
    A176774[n_] := A176774[n] = (m = 3; While[Reduce[k >= 1 && n == k (k (m - 2) - m + 4)/2, k, Integers] == False, m++]; m); a[6] = 0; a[p_?PrimeQ] := p; a[n_] := (x = 3; While[A176774[x] != n, x++]; x); Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 3, 100}] (* Jean-François Alcover, Sep 04 2016 *)

Formula

a(p) = p if p is any odd prime.

Extensions

More terms from R. J. Mathar, May 03 2010

A176949 Composite numbers n for which A176948(n) = n.

Original entry on oeis.org

4, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 77, 80, 86, 98, 104, 110, 116, 119, 122, 128, 134, 140, 143, 146, 152, 158, 161, 164, 170, 182, 187, 188, 194, 200, 203, 206, 209, 212, 218, 221, 224, 230, 236, 242, 248, 254, 266, 272, 278, 284, 290, 296, 299, 302
Offset: 1

Views

Author

Vladimir Shevelev, Apr 29 2010, Apr 30 2010

Keywords

Comments

If p >= 3 is prime, then A176948(p) = p. The sequence lists composite numbers with this property.
It is interesting that there is a large overlap with terms in A140164 (but there are exceptions, e.g., 77).
From Daniel Forgues, Jul 15 2016: (Start)
Composite numbers n which are not of form (k/2)*[(m-2)*k - (m-4)] for any m >= 3 and k >= 3, thus not m-gonal numbers for any order k >= 3.
An m-gonal number, m >= 3, i.e., of the form n = (k/2)*[(m-2)*k - (m-4)], yields a nontrivial factorization of n if and only if k >= 3.
Since we are looking for solutions of (m-2)*k^2 - (m-4)*k - 2*n = 0,
with m >= 3 and k >= 3, the largest order k we need to consider is
k = {(m-4) + sqrt[(m-4)^2 + 8*(m-2)*n]}/[2*(m-2)] with m = 3, thus
k <= (1/2)*{-1 + sqrt[1 + 8*n]}.
Or, since we are looking for solutions of 2n = m*k*(k-1) - 2*k*(k-2),
with m >= 3 and k >= 3, the largest m we need to consider is
m = [2n + 2*k*(k-2)]/[k*(k-1)] with order k = 3, thus m <= (n+3)/3.
Composite numbers n which are divisible by 3 are m-gonal numbers of order 3, with m = (n + 3)/3. Thus all a(n) are coprime to 3.
Odd composite numbers n which are divisible by 5 are m-gonal numbers of order 5, with m = (n + 15)/10. Thus all odd a(n) are coprime to 5.
a(1) = 4 is the only square number: 4-gonal with order k = 2. (End)
An integer n which is congruent to k (mod t_{k-1}) with 3 <= t_{k-1} < n, i.e. n = j * t_{k-1} + k with k >= 3 and j >= 1, is an m-gonal number of order k, with m = j + 2, where t_{k-1} is a triangular number. If all the congruence tests fail, a composite n belongs to this sequence. - Daniel Forgues, Aug 02 2016
From Jonathan Dushoff, Apr 05 2022: (Start)
All numbers n>2 are trivially n-gonal numbers, and will thus have A176948(n)=n unless they have a nontrivial polygonal decomposition. Thus this is just the sequence of non-polygonal composite numbers.
Note that the 2nd through 13th terms are in arithmetic progression.
Some reasons: many of the smaller odd numbers are prime (and thus don't appear); numbers of the form 6x (or 6x+3) are always order-3 numbers; numbers of the form 6x+4 are always order-4 numbers; small odd composites not divisible by 3 are usually divisible by 5, and are thus order-5 numbers.
In fact, the first number to break the arithmetic progression is the first product of distinct primes > 5.
Conversely, 6x+2 numbers cannot be order-3 or -6 numbers (those are divisible by 3); order-4 numbers (all == 4 (mod 6)); order-5 numbers (all odd); or order-7 numbers (all == 1 (mod 3)).
The first 6x+2 composite not in the list is order-8 pentagonal number 92. (End)

Examples

			8 is in the sequence since it is composite and is an octagonal number, but not a heptagonal number, hexagonal number, pentagonal number, etc. 10 is not in the sequence because even though it is composite and a decagonal number, it is also a triangular number: 10 = 1 + 2 + 3 + 4. - _Michael B. Porter_, Jul 16 2016
		

Crossrefs

Programs

  • Mathematica
    Select[Range[302], CompositeQ@ # && FindInstance[n*(4 + n*(s-2) - s)/2 == # && s >= 3 && n >= 3, {s, n}, Integers] == {} &] (* Giovanni Resta, Jul 13 2016 *)
  • PARI
    listc(nn) = {forcomposite(c=1, nn, sp = c; forstep(k=c, 3, -1, if (ispolygonal(c, k), sp=k);); if (sp == c, print1(c, ", ")););} \\ Michel Marcus, Sep 06 2016
  • Sage
    def is_a(n):
        if is_prime(n): return False
        for m in (3..(n+3)//3):
            if pari('ispolygonal')(n, m):
                return False
        return True
    print([n for n in (3..302) if is_a(n)]) # Peter Luschny, Jul 28 2016
    

Extensions

Offset corrected and sequence extended by R. J. Mathar, May 03 2010

A355774 An extension of the generalized pentagonal numbers such that every positive integer can be represented as the sum of at most two terms of the sequence.

Original entry on oeis.org

0, 1, 2, 5, 7, 11, 12, 15, 21, 22, 25, 26, 35, 39, 40, 49, 51, 57, 67, 70, 77, 87, 92, 100, 117, 120, 123, 126, 145, 153, 155, 173, 176, 182, 186, 187, 205, 210, 214, 222, 228, 241, 247, 251, 260, 283, 287, 301, 319, 330, 345, 376, 382, 392, 425, 435, 442, 448
Offset: 0

Views

Author

Peter Luschny, Jul 17 2022

Keywords

Comments

The sequence is defined inductively. Starting from the empty sequence, the terms are added one after the other. A term is added if it is a generalized pentagonal number or if it cannot be represented as the sum of two preceding terms. Note that these exceptions form a proper subsequence of A093519.
Thus any positive number can be expressed as the sum of at most two positive terms by Euler's Pentagonal Number Theorem. Every pentagonal number and every generalized pentagonal number is in this sequence.

Examples

			32 = 7 + 25; 195 = 22 + 173.
		

Crossrefs

Cf. A000326, A001318, A093519, A100878, A355717, A176747 (same construction with triangular numbers).

Programs

  • Maple
    A355774_list := proc(upto) local P, k, issum, isgpn; P := [];
    isgpn := k -> ormap(n -> 0 = 8*k-(n+irem(n,2))*(3*n+2-irem(n,2)), [$0..k]);
    issum := k -> ormap(p -> member(k - p, P), P);
    for k from 0 to upto do
        if isgpn(k) or not issum(k) then P := [op(P), k] fi od;
    P end: print(A355774_list(448));
  • Mathematica
    isgpn[k_] := AnyTrue[Range[0, k], 0 == 8*k-(#+Mod[#,2])*(3*#+2-Mod[#,2])&];
    issum[k_] := AnyTrue[P, MemberQ[P, k-#]&];
    P = {};
    For[k = 0, k <= 448, k++, If[isgpn[k] || !issum[k], AppendTo[P, k]]];
    P (* Jean-François Alcover, Mar 07 2024, after Peter Luschny *)
  • Python
    def A355774_list(upto: int) -> list[int]:
        P: list[int] = []
        for k in range(upto + 1):
            if any(
                k == ((n + n % 2) * (3 * n + 2 - n % 2)) >> 3
                for n in range(k + 1)
            ) or not any([(k - p) in P for p in P]):
                P.append(k)
        return P
    print(A355774_list(448))
Showing 1-5 of 5 results.