Post History
Python3, 39 bytes lambda n:all(n%i**2for i in range(2,n)) Try it online! Makes a list comprehension from the numbers 2 through n of the remainder of the square, and then checks whether the lis...
Answer
#12: Post edited
# [Python3](https://www.python.org/), 44 bytes- ```python
- lambda n:all(n%i**2for i in range(2,n))
- ```
- [Try it online!](https://tio.run/##PYxBCsIwFET3PcVQkCSlC02DSqFXcC8qEjGxgfS3NHEhpWePLYgDw7zNvOET256qZNFck9fd46lBtfae08YVhbT9CAdHGDW9DJclCZGiCfFO7y6gwWW3LSFVCSWXqpX3lTr89njLVgOthv@rzrBkGB1FbvOJ5hoTO5vA4CwsJwHjgwE79WzORfoC "Python 3 – Try It Online")
- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
- -5 bytes thanks to [Moshi](https://codegolf.codidact.com/users/53196)
- # [Python3](https://www.python.org/), 39 bytes
- ```python
- lambda n:all(n%i**2for i in range(2,n))
- ```
- [Try it online!](https://tio.run/##PYxBCsIwFET3PcVQkCSlC02DSqFXcC8qEjGxgfS3NHEhpWePLYgDw7zNvOET256qZNFck9fd46lBtfae08YVhbT9CAdHGDW9DJclCZGiCfFO7y6gwWW3LSFVCSWXqpX3lTr89njLVgOthv@rzrBkGB1FbvOJ5hoTO5vA4CwsJwHjgwE79WzORfoC "Python 3 – Try It Online")
- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
- -5 bytes thanks to [Moshi](https://codegolf.codidact.com/users/53196)
#11: Post edited
- # [Python3](https://www.python.org/), 44 bytes
- ```python
lambda n:not 0in[n%i**2 for i in range(2,n)]- ```
[Try it online!](https://tio.run/##PYzRCoIwGIXvfYqDEFPxwuaoEHyF7sMkFm010H@yrYsQn30pRAcO57s53/QJL0t11GivcZDj/SFBDdmAylBHO1MUHNo6GBiCk/RUGS8p72NQPtzoPXq06PZVCS5KCL5WbHyoxfG3pz7ZDLQZ/q8mwZrJGQqZTmdaGszsojyD0dAZ5VCDV2Bny5Y0j18 "Python 3 – Try It Online")- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
-8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
- # [Python3](https://www.python.org/), 44 bytes
- ```python
- lambda n:all(n%i**2for i in range(2,n))
- ```
- [Try it online!](https://tio.run/##PYxBCsIwFET3PcVQkCSlC02DSqFXcC8qEjGxgfS3NHEhpWePLYgDw7zNvOET256qZNFck9fd46lBtfae08YVhbT9CAdHGDW9DJclCZGiCfFO7y6gwWW3LSFVCSWXqpX3lTr89njLVgOthv@rzrBkGB1FbvOJ5hoTO5vA4CwsJwHjgwE79WzORfoC "Python 3 – Try It Online")
- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
- -5 bytes thanks to [Moshi](https://codegolf.codidact.com/users/53196)
#10: Post edited
# [Python3](https://www.python.org/), 45 bytes- ```python
lambda n:not 0in[n%(i*i) for i in range(2,n)]- ```
[Try it online!](https://tio.run/##PYzBCoJAGITvPsUQxO6GB9OlQvAVuodJGO3WD/qvuNshxGffFKKBYb7LfMMnvBwX0aK6xq7t748WXLILyIhr3krakYJ1IwjEGFt@GpmnrJoYjA83fvceFep9liLXKXS@VK98KPTxt6cmWQ28Gv6vMsGSYSQO0m4mnktM4mK8AFlYyQqm8wbi7MS8UfEL "Python 3 – Try It Online")- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
- # [Python3](https://www.python.org/), 44 bytes
- ```python
- lambda n:not 0in[n%i**2 for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYzRCoIwGIXvfYqDEFPxwuaoEHyF7sMkFm010H@yrYsQn30pRAcO57s53/QJL0t11GivcZDj/SFBDdmAylBHO1MUHNo6GBiCk/RUGS8p72NQPtzoPXq06PZVCS5KCL5WbHyoxfG3pz7ZDLQZ/q8mwZrJGQqZTmdaGszsojyD0dAZ5VCDV2Bny5Y0j18 "Python 3 – Try It Online")
- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
#9: Post edited
# [Python3](https://www.python.org/), 53 bytes- ```python
lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]- ```
[Try it online!](https://tio.run/##PYxNCsIwGET3PcUglCRQsD9BpZAruJdapGKigfZLaeJCSs8eWxAHhnmbeeMnvBxV0UBdY98N90cHqskFFJYaSq1SuVKc9lakFsZNsLCEqaOn5mVGoo1B@3Cj9@Ch0BR5hlJmkOVaufGhksffntpkM9Bm@L/qBGvGyVLgZjfTUmNmF@0ZrIHhJKB7r8HOji07Eb8 "Python 3 – Try It Online")Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- # [Python3](https://www.python.org/), 45 bytes
- ```python
- lambda n:not 0in[n%(i*i) for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYzBCoJAGITvPsUQxO6GB9OlQvAVuodJGO3WD/qvuNshxGffFKKBYb7LfMMnvBwX0aK6xq7t748WXLILyIhr3krakYJ1IwjEGFt@GpmnrJoYjA83fvceFep9liLXKXS@VK98KPTxt6cmWQ28Gv6vMsGSYSQO0m4mnktM4mK8AFlYyQqm8wbi7MS8UfEL "Python 3 – Try It Online")
- Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0`
- -8 bytes thanks to [celtschk](https://codegolf.codidact.com/users/8056)
#8: Post edited
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
[Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYxNCsIwGET3PcUglCRQsD9BpZAruJdapGKigfZLaeJCSs8eWxAHhnmbeeMnvBxV0UBdY98N90cHqskFFJYaSq1SuVKc9lakFsZNsLCEqaOn5mVGoo1B@3Cj9@Ch0BR5hlJmkOVaufGhksffntpkM9Bm@L/qBGvGyVLgZjfTUmNmF@0ZrIHhJKB7r8HOji07Eb8 "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
#7: Post edited
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")
Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`## Longer (more readable?) version (102 bytes)```pythondef f(n):for i in range(2,int(sqrt(n)+1)):n=(n/i if n%i==0 else n)if n%i==0:return 0return 1```[Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
#6: Post edited
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
## More friendly version (102 bytes)- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## Longer (more readable?) version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
#5: Post edited
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
[Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYtBCoMwFAX3nuIhiAkIVetKyBW6L1aKpUn9YH5ski6KeHarmw7Mbmb@xtHxeTPeWdghjiA7Ox8R3j4mBuq2TYN9PAdwyy6iIu44I6VKpQSfSGYE4zwIxPADv7SoC5b9FnWId/7YAIWuKgvUTYGm3m365Dj4OP5Vm2Bn9sRRmHThtcWSX3XIQQZGsISegkZ@cfmayu0H "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
#4: Post edited
# [Python3](https://www.python.org/), 59 bytes- ```python
lambda n:not 1in[n%i==0 and (n/i)%i==0 for i in range(2,n)]- ```
- [Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 53 bytes
- ```python
- lambda n:not 1in[n%i==0==(n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
#3: Post edited
# [Python3](https://www.python.org/), 61 bytes- ```python
lambda n:not 1in[not n%i and not (n/i)%i for i in range(2,n)]- ```
- [Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 59 bytes
- ```python
- lambda n:not 1in[n%i==0 and (n/i)%i==0 for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
#2: Post edited
# [Python3](https://www.python.org/), 102 bytes- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
- # [Python3](https://www.python.org/), 61 bytes
- ```python
- lambda n:not 1in[not n%i and not (n/i)%i for i in range(2,n)]
- ```
- [Try it online!](https://tio.run/##PYvBCsIwGIPve4ogSFsY6OZOg72Cd5lDKmtdYf0723qQsWev68VASAL5lm@cHF2S9s7CyjjB2MX5iPD2sdDo7mmW9jlKUEsuojLU56SjgaQRuXM6GbFv7TwMDMFLeilelySGFFWID/rYgA59dS5RNyWaenczFJmgTPxfbYFdizcUuT6stLVY2U0FBqOhOQmoOSiwq2PbQaQf "Python 3 – Try It Online")
- Makes a list comprehension of numbers from `2` to `n` of whether they factor into `n` twice, and then checks whether the list contains `True`
- ## More friendly version (102 bytes)
- ```python
- def f(n):
- for i in range(2,int(sqrt(n)+1)):
- n=(n/i if n%i==0 else n)
- if n%i==0:return 0
- return 1
- ```
- [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online")
- Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.
#1: Initial revision
# [Python3](https://www.python.org/), 102 bytes ```python def f(n): for i in range(2,int(sqrt(n)+1)): n=(n/i if n%i==0 else n) if n%i==0:return 0 return 1 ``` [Try it online!](https://tio.run/##PY5BCsIwFET3PcUgSBIs2NauCrmCexGRgokN2J@apAspPXtMULr4MPx58Gb6hMHSKWpnR4x9GGDGyboA/3YhPpSG5iS6Ato6GBiC6@mpeFMaCjxDqT7UIiMgyemYIA3aGykrqJdXIJGq7dc5FWZHqAr8Ux2D8uFO8@ghca2rEk1bom3StbciiymLNyqrgMnlBXq30NphYRflWbbkuT8vO1u27kT8Ag "Python 3 – Try It Online") Loops through 2 - the square root of the input number (rounded up) as `i`, and return `False` if `i` factors into the input number twice. If no instance of `i` factors twice into the input number then return `True`.