# Determine whether a number is 2017-friable without primes in your source code

## Jelly, 8 bytes

```
44‘²!*ḍ@
```

Try it online! Note that test cases **11111** and above are a bit too much for TIO.

### Verification

```
$ source="34,34,fc,82,21,2a,d5,40"
$ xxd -ps -r > 2017.jelly <<< $source
$ xxd -g 1 2017.jelly
0000000: 34 34 fc 82 21 2a d5 40 44..!*.@
$ eval printf '"%d "' 0x{$source}; echo # Code points in decimal
52 52 252 130 33 42 213 64
$ test_cases="1 2 80 2017 2019 2027 11111 45183 102349 999999 1234567 4068289"
$ for n in $test_cases; do printf "%11d: %d\n" $n $(jelly f 2017.jelly $n); done
1: 1
2: 1
80: 1
2017: 1
2019: 1
2027: 0
11111: 1
45183: 0
102349: 0
```

Test case **999999** has been running for 13 hours. I'm pessimistic about computing **2025! ^{4068289}**...

### How it works

```
44‘²!*ḍ@ Main link. Argument: n
44 Yield 44.
‘ Increment to yield 45.
² Square to yield 2025.
Note that no integers in [2018, ..., 2025] are prime numbers.
! Take the factorial of 2025.
* Raise it to the n-th power.
This repeats all prime factors in 2025! at least n times, so the result
will be divisible by n if (and only if) all of its prime factors fall
in the range [1, ..., 2025].
ḍ@ Test the result for divisibility by n.
```

## Jelly, 8 characters, 14 bytes of UTF-8

```
Æf½ṀḤ<90
```

Try it online!

Jelly normally uses its own codepage for programs. However, most of its prime-related builtins start with `Æ`

, which is codepoint 13; not very helpful. Luckily, the interpreter also supports UTF-8, which has a friendlier encoding.

### Verification

This program, in UTF-8, hexdumps like this:

```
00000000: c386 66c2 bde1 b980 e1b8 a43c 3930 ..f........<90
```

Verification that all the bytes are composite:

```
$ for x in c3 86 66 c2 bd e1 b9 80 e1 b8 a4 3c 39 30; do factor $((0x$x)); done
195: 3 5 13
134: 2 67
102: 2 3 17
194: 2 97
189: 3 3 3 7
225: 3 3 5 5
185: 5 37
128: 2 2 2 2 2 2 2
225: 3 3 5 5
184: 2 2 2 23
164: 2 2 41
60: 2 2 3 5
57: 3 19
48: 2 2 2 2 3
```

Verification that all the Unicode codepoints are composite:

```
$ perl -Mutf8 -E '$a = ord, print `factor $a` for split //, "Æf½ṀḤ<90"'
198: 2 3 3 11
102: 2 3 17
189: 3 3 3 7
7744: 2 2 2 2 2 2 11 11
7716: 2 2 3 643
60: 2 2 3 5
57: 3 19
48: 2 2 2 2 3
```

The only token parsed as a number is `90`

. None of `9`

, `0`

, and `90`

are prime.

### Explanation

The main mathematical insight here is that 45² is 2025, which neatly falls between 2017 (the current year) and 2027 (the next prime). Thus, we can take the square root of every prime factor of the number, and see if any exceeds 45. Unfortunately, we can't write `45`

due to the literal `5`

, so we have to double it and compare to 90 instead.

```
Æf½ṀḤ<90
Æf In the list of prime factors,
½ taking the square root of each element
Ṁ then taking the largest element
Ḥ and doubling it
<90 produces a result less than 90.
```

## Mathematica, ~~62~~ ~~58~~ 55 bytes

*The last three bytes saved are totally due to Martin Ender!*

```
#4<4||#<44*46&[#^-1#4]&[Divisors[#][[6-4]],,,#,,#0]&
```

Unnamed function taking a positive integer argument and returning `True`

or `False`

.

Recursive algorithm, with `#4<4`

being the truthy base case (we only need it to return `True`

on the imput 1, but the extra base cases are fine). Otherwise, we compute the second-smallest divisor (which is necessarily prime) of the input with `Divisors[#][[6-4]]`

; if it's greater than 2024 (`44*46`

) then we exit with `False`

, otherwise we call the function recursively (using `#6`

set to `#0`

) on the input divided by this small prime factor `#`

(which we have to express as `#^-1`

times the input `#4`

, since `/`

is disallowed).

Structurally, the first half `#4<4||#<44*46&[#^-1#4]&`

is an anonymous function of six arguments, being called with arguments `Divisors[#][[6-4]]`

, `Null`

, `Null`

, `#`

, `Null`

, and `#0`

; this is to get around the prohibition on the characters `2`

, `3`

, and `5`

.

Previous version, which saved four bytes by replacing `8018-6000`

with `44*46`

, inspired by ais523's Jelly answer (Martin Ender also seemed inspired by an ais523 comment):

```
#<4||Divisors[#][[6-4]]<44*46&�[Divisors[#][[6-4]]^-1#]&
```

This was pretty nasty: I still don't know a way to actually set a variable in Mathematica under these restrictions! Both `=`

and the `e`

in `Set`

are disallowed. Avoiding `+`

and `)`

was also an issue, but not too hard to work around at the expense of more bytes.