Skip to main content
deleted 164 characters in body
Source Link
user18932
user18932

Java, 21 5757 24 bytes

Try it online!Try it online!

Golfed:

n->{while(n>20&n%3!=0)n-=20;return n>3&(n%20<1|n%3<1=n*2%3*20);}>=0&n!=3

Ungolfed:

import java.util.*;

public class ChickenMcNuggetNumbers {

  private static final Set<Integer> FALSE_VALUES = new HashSet<>(Arrays.asList(
    new Integer[] { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n -> {
        while (n > 20 & n % 3 != 0)
          n -= 20;
        return n > 3 & (n % 20 < 1 | n % 3 < 1=n*2%3*20);
      } >=0&n!=3, i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}

Java, 21 57 bytes

Try it online!

Golfed:

n->{while(n>20&n%3!=0)n-=20;return n>3&(n%20<1|n%3<1);}

Ungolfed:

import java.util.*;

public class ChickenMcNuggetNumbers {

  private static final Set<Integer> FALSE_VALUES = new HashSet<>(Arrays.asList(
    new Integer[] { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n -> {
        while (n > 20 & n % 3 != 0)
          n -= 20;
        return n > 3 & (n % 20 < 1 | n % 3 < 1);
      } , i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}

Java, 21 57 24 bytes

Try it online!

Golfed:

n->(n-=n*2%3*20)>=0&n!=3

Ungolfed:

import java.util.*;

public class ChickenMcNuggetNumbers {

  private static final Set<Integer> FALSE_VALUES = new HashSet<>(Arrays.asList(
    new Integer[] { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n->(n-=n*2%3*20)>=0&n!=3, i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}
Fixed incorrect results.
Source Link
user18932
user18932

Java, 2121 57 bytes

Try it online!Try it online!

Golfed:

n->n>3&>{while(n>20&n%3!=0)n-=20;return n>3&(n%20<1|n%3<1);}

Ungolfed:

import java.util.*;

public class ChickenMcNuggetNumbers { 

  publicprivate static void main(String[] args) {
final Set<Integer> FALSE_VALUES = fornew HashSet<>(intArrays.asList(
 i :  new int[]Integer[] { 0, 61, 2, 3, 4, 5, 7, 128, 1510, 2111, 4013, 4214, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n ->n> {
        while (n > 20 & n % 3 != 0)
          n -= 20;
        return n > 3 & (n % 20 < 1 | n % 3 < 1);
      } , i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}

Java, 21 bytes

Try it online!

Golfed:

n->n>3&(n%20<1|n%3<1)

Ungolfed:

public class ChickenMcNuggetNumbers {
  public static void main(String[] args) {
    for (int i : new int[] { 0, 6, 7, 12, 15, 21, 40, 42 }) {
      System.out.println(i + " -> " + f(n->n > 3 & (n % 20 < 1 | n % 3 < 1), i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}

Java, 21 57 bytes

Try it online!

Golfed:

n->{while(n>20&n%3!=0)n-=20;return n>3&(n%20<1|n%3<1);}

Ungolfed:

import java.util.*;

public class ChickenMcNuggetNumbers { 

  private static final Set<Integer> FALSE_VALUES = new HashSet<>(Arrays.asList(
    new Integer[] { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n -> {
        while (n > 20 & n % 3 != 0)
          n -= 20;
        return n > 3 & (n % 20 < 1 | n % 3 < 1);
      } , i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}
Source Link
user18932
user18932

Java, 21 bytes

Try it online!

Golfed:

n->n>3&(n%20<1|n%3<1)

Ungolfed:

public class ChickenMcNuggetNumbers {
  public static void main(String[] args) {
    for (int i : new int[] { 0, 6, 7, 12, 15, 21, 40, 42 }) {
      System.out.println(i + " -> " + f(n->n > 3 & (n % 20 < 1 | n % 3 < 1), i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}