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.
%I A355717 #59 Mar 22 2025 23:34:27 %S A355717 0,1,1,2,2,1,2,1,2,2,2,3,1,2,2,1,2,2,3,2,2,3,1,2,2,3,1,2,2,2,2,2,3,2, %T A355717 2,1,2,2,2,3,1,2,2,3,2,2,3,2,2,3,2,1,2,2,3,2,2,1,2,2,3,2,2,2,2,3,2,3, %U A355717 3,2,1,2,2,2,3,2,3,1,2,2,2,3,2,2,2,2,2,3,3,2,3,2,1,2,2,3,2,2,3,2,1 %N A355717 Smallest number of generalized pentagonal numbers which sum to n. %C A355717 From Euler's Pentagonal Number Theorem, every number is expressible as the sum of at most three generalized pentagonal numbers (A001318) (see Richard K. Guy reference). %C A355717 Corresponding sums of only pentagonal numbers of positive rank are A100878(n). Those numbers are a subset of the generalized pentagonals so that a(n) <= A100878(n). %C A355717 More specifically, by the definition given in the name, we understand the following: Given n >= 0 we seek a multiset S such that (1) S is a multiset of GPN = {0, 1, 2, 5, ...} = A001318; (2) Sum(S) = n; (3) if T is a multiset of GPN and Sum(T) = n then card(T) >= card(S). Additionally one might require that the set is not empty. If a multiset satisfies these three conditions, then a(n) = card(S). Note that no actual summation has to be performed to decide the value of a(n); only membership in GPN needs to be tested, as shown in the Maple and Python program. - _Peter Luschny_, Jul 18 2022 %D A355717 Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section D3, Figurate numbers, pp. 222-228. %H A355717 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PentagonalNumberTheorem.html">Pentagonal Number Theorem</a>. %F A355717 a(n) <= 3. %F A355717 a(A001318(n)) = 1. %e A355717 Let GPN = {0, 1, 2, 5, ...} be the generalized pentagonal numbers. %e A355717 a(0) = 0 since {} is a multiset of GPN, Sum {} = 0, and card({}) = 0. %e A355717 a(1) = 1 since {1} is a multiset of GPN, Sum {1} = 1, and card({1}) = 1. %e A355717 a(3) = 2 since {1, 2} is a multiset of GPN, Sum {1, 2} = 3, and card({1, 2}) = 2. %e A355717 a(11) = 3 since {2, 2, 7} is a multiset of GPN, Sum {2, 2, 7} = 11, card({2, 2, 7}) = 3, and no other multiset S of GPN with Sum(S) = 11 has less members. %p A355717 A355717_list := proc(upto) local P, Q, k, q, isgpn; P := []; Q := [0]; %p A355717 isgpn := k -> ormap(n -> 0 = 8*k - (n + irem(n,2)) * (3*n + 2 - irem(n,2)), [$0..k]); %p A355717 for k from 1 to upto do %p A355717 q := 3; %p A355717 if isgpn(k) then %p A355717 P := [op(P), k]; q := 1; %p A355717 elif ormap(p -> member(k - p, P), P) then q := 2 fi: %p A355717 Q := [op(Q), q]; %p A355717 od: Q end: %p A355717 print(A355717_list(100)); # _Peter Luschny_, Jul 18 2022 %o A355717 (Python) %o A355717 def A355717_list(ln: int) -> list[int]: %o A355717 P: list[int] = [] %o A355717 Q: list[int] = [0] %o A355717 def is_gpn(k: int) -> bool: %o A355717 return any(8 * k == ((n + n % 2) * (3 * n + 2 - n % 2)) for n in range(k + 1)) %o A355717 for k in range(1, ln): %o A355717 q = 3 %o A355717 if is_gpn(k): %o A355717 P.append(k) %o A355717 q = 1 %o A355717 elif any([(k - p) in P for p in P]): %o A355717 q = 2 %o A355717 Q.append(q) %o A355717 return Q %o A355717 print(A355717_list(100)) # _Peter Luschny_, Jul 18 2022 %Y A355717 Cf. A001318, A093519 (indices of 3's). %Y A355717 Cf. A100878. %K A355717 nonn %O A355717 0,4 %A A355717 _Bernard Schott_, Jul 15 2022