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.

A343760 Numbers whose digits can be the lengths of the sides of a polygon.

Original entry on oeis.org

111, 122, 133, 144, 155, 166, 177, 188, 199, 212, 221, 222, 223, 232, 233, 234, 243, 244, 245, 254, 255, 256, 265, 266, 267, 276, 277, 278, 287, 288, 289, 298, 299, 313, 322, 323, 324, 331, 332, 333, 334, 335, 342, 343, 344
Offset: 1

Views

Author

John R Phelan, Apr 27 2021

Keywords

Comments

The length of each side must be greater than 0 and less than the sum of the other sides.
Subset of the 0-free numbers, A052382, and eventually contains all the 0-free numbers > 9111111111.

Examples

			110 is not a term since the 3rd side has a length of 0.
111 is a term since a polygon (in this case a triangle) can have sides of length 1,1,1.
112 is not a term since the length of the 3rd side is not less than the sum of the other two sides.
		

Crossrefs

Cf. A052382.

Programs

  • Java
    public class A343760 {
       public static void main(String[] args) {
          for (long n = 1; n < 1000; n++) {
             if (is(n)) {
                System.out.print(n + ", ");
             }
          }
       }
       public static boolean is(long n) {
          String s = String.valueOf(n);
          if (n < 0 || s.contains("0")) {
             return false;
          }
          int perimeter = 0;
          char[] sides = s.toCharArray();
          for (int i = 0; i < sides.length; i++) {
             sides[i] -= '0';
             perimeter += sides[i];
          }
          for (int side : sides) {
             if (perimeter <= 2 * side) {
                return false;
             }
          }
          return true;
       }
    }
  • Mathematica
    Select[Range[111, 344], AllTrue[TakeDrop[#, 1] & /@ Permutations@ IntegerDigits[#], First[#1] < Total[#2] & @@ # &] &] (* Michael De Vlieger, May 01 2021 *)