# Substring factor [FINALIZED]

# Now posted: Substring factor

Does a positive integer have a substring as a factor?

## Input

- A positive integer.

## Output

- One of 2 distinct values to indicate whether the input has a factor that is a strict substring of its base 10 (decimal) representation.
- Only strict substrings count - a string does not count as a strict substring of itself.
- A substring must be contiguous, unlike a subsequence.
- The factor does not need to be a prime factor - any divisor will do, including a composite factor or 1.
- Zero is not a factor of any number.

## Examples

### Example with a single digit input

Input: `4`

Output: `false`

A single digit integer has no non-empty strict substrings, so the output for any single digit input will be `false`

(or whichever value you choose to consistently represent this).

### Example with a substring factor

Input: `370`

Output: `true`

The input has a substring 37, and 37 is a factor of 370 (that is, 370 can be divided by 37 with no remainder).

### Example with only a subsequence factor

Input: `253`

Output: `false`

The input has a * subsequence* 23, and 23 is a factor of 253, but 23 is not a

*(that is, not a contiguous subsequence), so this does not count. None of the substrings of 253 is a factor of 253.*

**substring**### Example with a composite factor

Input: `44`

Output: `true`

The input has a substring 4, and 4 is a factor of 44. Factors do not need to be prime.

### Example with 1 as a factor

Input: `31`

Output: `true`

The input has a substring 1, and 1 is a factor of 31.

## Test cases

- Test cases are in the format
`input : output`

. - You may use any 2 distinct values in place of
`true`

and`false`

.

```
4 : false
31 : true
44 : true
253 : false
370 : true
123456 : true
345678 : true
456789 : false
300007 : false
700003 : false
672297 : true
828477 : true
836537 : true
963833 : true
4506337 : true
5480778 : true
6355037 : true
23278699 : true
22222223 : false
```

## Scoring

This is a code golf challenge. Your score is the number of bytes in your code. Lowest score for each language wins.

Explanations are optional, but I'm more likely to upvote answers that have one.

## 0 comment threads