Post History
J, 7 char *./~:q: How it works: 'q:' produces prime factors of number on right '~:' replaces the first instance of unique numbers with a 1, the rest 0 '*./' tests for all ones Sample runs: ...
Answer
#8: Post edited
# J, 10 char- ```
- (#=#@~.)q:
- ```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- **Sample runs:**
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- # J, 7 char
- ```
- *./~:q:
- ```
- **How it works:**
- 'q:' produces prime factors of number on right
- '~:' replaces the first instance of unique numbers with a 1, the rest 0
- '*./' tests for all ones
- **Sample runs:**
- *./~:q: 30
- 1
- *./~:q: 40
- 0
- *./~:q: 50
- 0
- *./~:q: 100
- 0
- *./~:q: 110
- 1
- *./~:q: 111
- 1
- **Alternative 10 char solution:**
- ```
- (#=#@~.)q:
- ```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- **Sample runs:**
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
#7: Post edited
# J, 14 char```(#@q:=#@~.@q:)```- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- **Sample runs:**
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- # J, 10 char
- ```
- (#=#@~.)q:
- ```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- **Sample runs:**
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
#6: Post edited
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
** sample runs **- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- **Sample runs:**
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
#5: Post edited
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- ** sample runs **
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
#4: Post edited
# J, 14 char ```(#@q:=#@~.@q:)```- **How it works:**
```q: of the number on the right produces its prime factors# counts how many there are~. eliminates repeats.- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
```
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- 'q:' of the number on the right produces its prime factors
- '#' counts how many there are
- '~.' eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
#3: Post edited
# J, 14 char```(#@q:=#@~.@q:)```- **How it works:**
- ```
- q: of the number on the right produces its prime factors
- # counts how many there are
- ~. eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- ```
- # J, 14 char ```(#@q:=#@~.@q:)```
- **How it works:**
- ```
- q: of the number on the right produces its prime factors
- # counts how many there are
- ~. eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- ```
#2: Post edited
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- q: of the number on the right produces its prime factors
- # counts how many there are
- ~. eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
1
- # J, 14 char
- ```(#@q:=#@~.@q:)```
- **How it works:**
- ```
- q: of the number on the right produces its prime factors
- # counts how many there are
- ~. eliminates repeats.
- if the counts of factors before and after removing repeats are equal, then the number is square-free.
- (#@q:=#@~.@q:) 30
- 1
- (#@q:=#@~.@q:) 40
- 0
- (#@q:=#@~.@q:) 50
- 0
- (#@q:=#@~.@q:) 100
- 0
- (#@q:=#@~.@q:) 110
- 1
- (#@q:=#@~.@q:) 111
- 1
- ```
#1: Initial revision
# J, 14 char ```(#@q:=#@~.@q:)``` **How it works:** q: of the number on the right produces its prime factors # counts how many there are ~. eliminates repeats. if the counts of factors before and after removing repeats are equal, then the number is square-free. (#@q:=#@~.@q:) 30 1 (#@q:=#@~.@q:) 40 0 (#@q:=#@~.@q:) 50 0 (#@q:=#@~.@q:) 100 0 (#@q:=#@~.@q:) 110 1 (#@q:=#@~.@q:) 111 1