[Question]
  [
Given a nonnegative integer, return whether it is a three digit number ending in one, in any consistent integer base. In other words, the number needs to be represented in base-N, N being an integer greater than zero.
## Rules
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer wins.
* Since unary behaves weirdly, the behavior with input 310 is undefined.
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are prohibited.
## Examples
True:
```
5   
73  
101 
1073
17
22
36
55
99  
```
False:
```
8
18
23
27
98
90
88
72
68
```
A handful of large numbers:
```
46656 true
46657 true
46658 true
46659 true
46660 true
46661 false
46662 false
46663 true
46664 false
46665 true
46666 true
46667 false
46668 false
46669 false
46670 true
46671 true
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
bRṫ€3ċJ
```
Returns the number of bases (non-zero being truthy, zero being falsy) in which the input is a three digit number ending in one.
[Try it online!](https://tio.run/##y0rNyan8/z8p6OHO1Y@a1hgf6fb6f3TP4XYg2/3//2hTHQVzYx0FQwNDEAFmmusoGBnpKBib6SiYAqUtLXW4FCyA4kCsYARUACSBSiyBXEsDHQULIG0OVG5mAVSmVZSYl56qYWJmZgrUDaTMjTQV0EAsAA "Jelly – Try It Online")
### How it works
```
bRṫ€3ċJ  Main link. Argument: n
 R       Range; yield [1, ..., n].
b        Base; convert n to bases 1, ..., n.
  ṫ€3    Tail each 3; remove the first two elements of each digit array.
      J  Indices of [n]; yield [1].
     ċ   Count the number of times [1] appears in the result to the left.
```
[Answer]
# JavaScript (ES7), ~~43~~ ~~40~~ 39 bytes
```
f=(n,b)=>n<b*b?0:n%b==1&n<b**3|f(n,-~b)
```
### Test cases
```
f=(n,b)=>n<b*b?0:n%b==1&n<b**3|f(n,-~b)
console.log('[Truthy]')
console.log(f(5))
console.log(f(73))
console.log(f(101))
console.log(f(1073))
console.log(f(17))
console.log(f(22))
console.log(f(36))
console.log(f(55))
console.log(f(99))
console.log(f(46656))
console.log(f(46657))
console.log(f(46658))
console.log(f(46659))
console.log(f(46660))
console.log(f(46663))
console.log(f(46665))
console.log(f(46666))
console.log(f(46670))
console.log(f(46671))
console.log('[Falsy]')
console.log(f(8))
console.log(f(18))
console.log(f(23))
console.log(f(27))
console.log(f(98))
console.log(f(90))
console.log(f(88))
console.log(f(72))
console.log(f(68))
console.log(f(46661))
console.log(f(46662))
console.log(f(46664))
console.log(f(46667))
console.log(f(46668))
console.log(f(46669))
```
### Commented
```
f = (n,           // given n = input
        b) =>     // and using b = base, initially undefined
  n < b * b ?     // if n is less than b²:
    0             //   n has less than 3 digits in base b or above -> failure
  :               // else:
    n % b == 1 &  //   return a truthy value if n is congruent to 1 modulo b
    n < b**3 |    //   and n is less than b³ (i.e. has less than 4 digits in base b)
    f(n, -~b)     //   or the above conditions are true for some greater value of b
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~50~~ 47 bytes
-2 bytes thanks to [@LeakyNun](https://codegolf.stackexchange.com/users/48934/leaky-nun)  
-1 byte thanks to [@Dennis](https://codegolf.stackexchange.com/users/12012/dennis)
```
lambda n:any(i>n/i/i>n%i==1for i in range(2,n))
```
[Try it online!](https://tio.run/##LY/BCoMwDIbve4pcBhUCs61NV8E9yS6Oza2wRREvPr1LjYfmC/9fPsi0Lp@R/TZ09@3b/x7PHrjteTX5xpd8kXnOXWeHcYYMmWHu@f0yDrmqthJyCQNC9Ai2tmXsa0RwDsETQpA6JYSrxPKc1E7qJHuqJRZG@UrChiiQIiqOMO2gWmEVTuEVjSIo1EJqOdSklqiWaNsTwDRnXgwjDKac9Ac "Python 3 – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~41~~ 40 bytes
```
f n=or[mod n k==1|k<-[2..n],k^2<n,n<k^3]
```
*Thanks to @Zgarb for golfing off 1 byte!*
[Try it online!](https://tio.run/##FcZLCoMwFEbhrdxBB4p/g4nNQ9BVdCgRhCpK9Co@6KR7tzo4nK9vttCO43l2xOW8VtP8IaZQlvIXimelhGCPUKuCwUWoM39OzcBU0nLs732lBx08Dtxul6Zmoa2fvxTd6iiqNGwGmcqrGxZKITPQGnkOB@mgMiiL3CFP4RysgnGekoSqlzHaCHHNSh/H5x8 "Haskell – Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 10 bytes
```
≥ℕ≜;?ḃ₍Ṫt1
```
[Try it online!](https://tio.run/##JcwxCgIxEIXh21i9IplsZhIsvIdioRZaCILYiNjERdjC0s5KsLGy1DN4is1FojtbzMcw8M98O1us9uvNksohn185pcHxey@5eeT6mpvbcNS@Tzld2s9zZ0uZeIiDNfY/3SIggmN4jxgRYAPIgQQxIBqEACFwQMXsWRW1v8RONqpVSXVqpXpVW9a2/8bairZip2X8Aw "Brachylog – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~11~~ 8 bytes
Saved 3 bytes thanks to *Adnan*.
```
Lв3ù€θ1å
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f58Im48M7HzWtObfD8PDS//8NjcwB "05AB1E – Try It Online")
**Explanation**
```
Lв            # convert input to bases [1 ... input]
  ʒg3Q}       # keep only elements of length 3
       €θ     # get the last item of each
         1å   # is there any 1?
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
```
bRµL€żṪ€3,1e
```
[Try it online!](https://tio.run/##y0rNyan8/z8p6NBWn0dNa47uebhzFZA21jFM/f//v6GBuTEA "Jelly – Try It Online")
[Answer]
# Mathematica, 43 bytes
```
!FreeQ[IntegerDigits[#,2~Range~#],{_,_,1}]&
```
[Try it online!](https://tio.run/##FcaxCoMwFAXQbylCpwuaF2JehoKDFLq1XUUklKfNYIY0m@ivp@1w4Kw@v2X1Obx8mS/ldE0ij@EWsyyS@rCE/Bkq0PH0cZGjGrFNmKD28VzuKcRcd3PdbQZWQzXq5x8LIugWxsA5MBSDNMjCMVwDZlhCy3v5Ag "Wolfram Language (Mathematica) – Try It Online")
or [Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7X9GtKDU1MNozryQ1PbXIJTM9s6Q4WlnHqC4oMS89tU45Vqc6Xidex7A2Vu1/QFFmXom@Q5q@A1gy2sTMzNRMB0iaG8b@BwA "Wolfram Language (Mathematica) – Try It Online") (large numbers)
*Martin Ender saved 3 bytes*
[Answer]
## [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 35 bytes
```
Or@@Array[x~Mod~#==1<x/#^2<#&,x=#]&
```
[Try it online!](https://tio.run/##FcbRCsIgFAbghxF29YPziPMIE@wBou5jA6lGu9gC8cKI9uquXXzwLTG/nkvM8z3WyddLCuGUUvzcynZ@PzbhveqLFCP1okHxYmjqNc1rlmGS4WtgNVSr/o5YEEF3MAbOgaEYpEEWjuFaMMMSOv7VHQ "Wolfram Language (Mathematica) – Try It Online")
Explicitly checks whether **n % i = 1** and **i2 < n < i3** for any possible base **i**. For golfing purposes, the inequality is rearranged to **1 < n/i2 < i**, so that it can be chained onto the equality.
[Answer]
# [Clean](https://clean.cs.ru.nl), ~~58~~ 56 bytes
***-2*** thanks to [Dennis](https://codegolf.stackexchange.com/questions/150785/is-this-a-three-digit-number-ending-in-one/150791?noredirect=1#comment368776_150791)
```
import StdEnv
@n=or[n>m^2&&n<m^3&&n rem m==1\\m<-[2..n]]
```
[Try it online!](https://tio.run/##S85JTcz7n5ufUpqTqpCbmJn3PzO3IL@oRCG4JMU1r4zLIc82vyg6zy43zkhNLc8mN84YSCkUpeYq5NraGsbE5NroRhvp6eXFxv4PLkkE6rNVcFCwtPz/LzktJzG9@L@up89/l8q8xNzM5GIA "Clean – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 10 bytes
```
€;1ṠMo↓2Bḣ
```
[Try it online!](https://tio.run/##ASAA3/9odXNr///igqw7MeG5oE1v4oaTMkLhuKP///80NjY2MQ "Husk – Try It Online")
Pretty close to [the Jelly answer of Dennis](https://codegolf.stackexchange.com/a/150794/32014).
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~21~~ ~~20~~ 14 bytesSBCS
-5 thanks to @ngn.
Purely arithmetic solution (doesn't actually do any base conversions) and thus very fast.
```
3∊⊢(|×∘⌈⍟)⍨1↓⍳
```
[Try it online!](https://tio.run/##Jc4xCsIwFMbx3VN8ow5CkzQvyQWcHL1AwdqloFQcBOdSigHBQRcRnLp7A73Ju0htn0N@vOH7Q7JdOV8fs3Jb9P2G64vhpuX2NT19b9zc@dxwfM44dorrK8f3MPp0Fs5AJWp44@GgNQzBWoQAcHxgVR3yybD0UB7aQDsEj5DAezgN8rJaZOVeZimRJYw60YthlBJRiVo0YipaUVqSlqQlaZ20Tv3/tMyqIp/8AA "APL (Dyalog Unicode) – Try It Online")
`⊢(`…`)⍨1↓⍳` on one dropped from the **ɩ**ndices 1…argument and the argument, apply:
 `|` the division remainders
 `×∘⌈` times the rounded-up
 `⍟` logN Argument
`3∊` is three a member of that?
[Answer]
# [Pyth](https://pyth.readthedocs.io), 10 bytes
```
}]1>R2jLQS
```
**[Verify all the test cases.](https://pyth.herokuapp.com/?code=%7D%5D1%3ER2jLQS&test_suite=1&test_suite_input=73++%0A101+%0A1073%0A17%0A22%0A36%0A55%0A99++%0A8%0A18%0A23%0A27%0A98%0A90%0A88%0A72%0A68&debug=0)**
[Answer]
# [Husk](https://github.com/barbuz/Husk), 15 bytes
```
V§&o=1→o=3LṠMBḣ
```
[Try it online!](https://tio.run/##ASEA3v9odXNr//9Wwqcmbz0x4oaSbz0zTOG5oE1C4bij////MjM "Husk – Try It Online")
### Explanation
```
V§&(=1→)(=3L)ṠMBḣ  -- implicit input, for example: 5
             ṠMB   -- map "convert 5 to base" over..
                ḣ  --   range [1..5]
                   -- [[1,1,1,1,1],[1,0,1],[1,2],[1,1],[1,0]]
V                  -- does any of the elements satisfy the following
 §&( 1 )( 2 )      --   apply functions 1,2 and join with & (logical and)
         =3L       --     is length equals to 3?
    =1→            --     is last digit 1?
```
[Answer]
# PHP, 48+1 bytes
```
while(++$b**2<$n=$argn)$n%$b-1|$n>$b**3||die(1);
```
exits with `0` for falsy (or input `3`), `1` for truthy.  
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/afc2cbb631c1ff4a37d62ddacaa77d5c49e5c348).
[Answer]
# C, 60 bytes
A function that returns non-zero if the argument can be represented as a three-digit number ending in 1:
```
i,j;f(n){for(j=0,i=sqrt(n);i>cbrt(n);)j+=n%i--==1;return j;}
```
Note: this works with GCC, where the functions are built-in. For other compilers, you probably need to ensure that the argument and return types are known:
```
#include<math.h>
```
# Explanation
The lowest base in which `n` is represented in 3 digits is `⌊∛n⌋`, and the lowest base in which `n` is represented in 2 digits is `⌊√n⌋`, so we simply test whether the number is congruent to 1 modulo any bases in the 3-digit range. We return the count of the number of bases satisfying the condition, giving a non-zero (truthy) or zero (falsy) value as appropriate.
# Test program
Pass any number of inputs as positional parameters:
```
#include<stdio.h>
int main(int c,char**v)
{
    while(*++v)
        printf("%s => %d\n", *v, f(atoi(*v)));
}
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 19 bytesSBCS
[Dennis' method](https://codegolf.stackexchange.com/a/150794/43319).
```
(⊂,1)∊2↓¨⊢⊥⍣¯1¨⍨1↓⍳
```
[Try it online!](https://tio.run/##Jc4xCsJAEAXQPqf4pYJCdpOd3b2AlaUXCBjTBJSIha1FkIWAYG2jCOksvEGOMheJm7HYx8zwP2xxqJfbc1Hvq3HccXubcbgs1JyvQXN7H3oOTw5v7l7DR8Wt61U8c/eN6aE3sBlUquKbBgutkRGMgfcAdw9smlOZxKSDctAZtIV38Cmcg9UgJ6lVUR8llhMZwqQVnegnKRWVqMVMzEUjSpekS9Il6VrpWvX/07poqjL5AQ "APL (Dyalog Unicode) – Try It Online")
`(⊂,1)∊` Is `[1]` a member of
`2↓¨` two elements dropped from each of
`⊢⊥⍣¯1¨⍨` the argument represented in each of the bases
`1↓⍳` one dropped from the **ɩ**ndices 1 through the argument?
[Answer]
# [Julia](http://julialang.org/), 31 bytes
```
n->any(i>n/i^2>n%i==1for i=2:n)
```
[Try it online!](https://tio.run/##LYxBCsIwEEX3nmIoFRKI2KTNxAjpRUShoIVIGaXowtPHaaeLzPv8H97zO@UBy5gKHfqBfir3dMw319M@p2TH1ww5uTPpskSCTHDxBkJrwDZ2OWsMBpwz0KIBz3OMBk5c83M8O54j59hwzQz8FZkdokdBEGxlXIGNwAqcoBV0Ai8QC4plU6NYgliCve4A3nOmz0SqqglqNSrSutK7B93LHw "Julia 0.6 – Try It Online")
[Answer]
# [Pyt](https://github.com/mudkip201/pyt), ~~35~~ 33 [bytes](https://github.com/mudkip201/pyt/wiki/Codepage)
```
←ĐĐ3=?∧∧:ŕĐ2⇹Ř⇹Ľ⅟⌊⁺3=⇹Đ2⇹Ř%*ž1⇹∈;
```
Explanation:
```
←ĐĐ                                             Push input onto stack 3 times
   3=?  :                       ;               If input equals 3, execute code after the question mark;otherwise, execute code after the colon. In either case, afterwards, execute the code after the semicolon
      ∧∧                                        Get 'True'
        :                                       Input not equal to 3
         ŕ                                      Remove 'False'
          Đ2⇹Ř                                  Push [2,3,...,n]
              ⇹Ľ⅟⌊⁺                             Push [floor(log_2(n))+1,floor(log_3(n))+1,...,floor(log_n(n))+1]
                   3=                           Is each element equal to 3
                     ⇹                          Swap the top two elements on the stack (putting n back on top)
                      Đ2⇹Ř                      Push [2,3,...,n]
                          %                     Push [n%2,n%3,...,n%n]
                           *                    Multiply [n%x] by the other array (i.e. is floor(log_x(n))+1=3?)
                            ž                   Remove all zeroes from the array
                             1⇹∈                Is 1 in the array?
                                ;               End conditional
                                                Implicit print
```
[Try it online!](https://tio.run/##K6gs@f//UduEI0BobGv/qGM5EFkdnXpkgtGj9p1HZwCJI3sftc5/1NP1qHGXsS2ID5VS1Tq6zxDIetTRYf3/v7kxAA)
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 42 bytes
```
1<v?)}:{*::+
n~\1-:::**{:}):?!n~:{:}$%1=:?
```
[Try it online!](https://tio.run/##S8sszvj/39CmzF6z1qpay8pKmyuvLsZQ18rKSkur2qpW08peMa/OCshSUTW0tbL///@/bpmREQA "><> – Try It Online")
Returns `10` for truthy, `00` for falsey.
]