A343760 Numbers whose digits can be the lengths of the sides of a polygon.
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
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.
Links
- Maths StackExchange, The no. of possible 3 digit number abc if a,b,c are the sides of a isosceles triangle.
- Wikipedia, Integer Triangle
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 *)
Comments