Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of numbers.
4
votes
Prime Difference
Perl 6, 40 bytes
{1-$_+first ++($*=!*.is-prime)>=$_,2..*}
Try it online!
38 bytes, 0-based (I'm not sure this is allowed):
{-$_+first ++($*=!*.is-prime)>$_,2..*}
Try it online!
2
votes
Triangular Square Numbers
Perl 6, 25 - 8 = 17 bytes
{(0,1,2-*+34* *…*)[$_]}
Try it online!
2
votes
Given a sequence of numbers, print out all possible sets such that the sum is less than a nu...
05AB1E, 6 bytes
.ÆêʒO@
Try it online!
4
votes
Find self-locating strings in a number
05AB1E, 9 bytes
āʒ.$yÅ?}O
Try it online!
2
votes
Triangular Square Numbers
05AB1E, 10 - 8 = 2 bytes
1ÎGDŠ34*Ìα
Try it online!
2
votes
Letters in phone numbers
05AB1E, 11 bytes
Aā6+žq÷T9:‡
Try it online!
A # alphabet: "abcdefghijklmnoqrstuvwxyz"
ā # length range: [1..26]
6+ # add 6 to each: [7..32]
žq÷ …
28
votes
Accepted
Count rotary dial pulses in a phone number (including letters)
I wonder if there’s any number that’s approximately 3+1/7 and takes fewer bytes than 22/7…
This only gives 4 7s, not 4 9s, so we still need to handle Z as a special case. …
1
vote
How many Lynch-Bell numbers are there?
Perl 5, 80 76 bytes (75 + -p)
$\+=!grep$_?$;%$_|$|{0,$_}++:1,@@until($@[$}++]+=1)%=$_ and++$;,$}=$}==$_}{
Abusing $; for fun and profit. Times out on inputs > 8.
EDIT: -4 bytes by merging the two …
1
vote
Closest 7-Distinct-Prime Product
05AB1E, 10 bytes
°Åp7.ÆPs.x
Try it online!
Tries all combinations of 7 of the first 10**input primes. Runs out of memory for inputs greater than 1.
Considerably more efficient 14 bytes version:
…
1
vote
Accepted
Composite Factorization
05AB1E, 8 bytes
Òā¨ÉÅ¡P¦
Try it online!
Explanation:
# implicit input (example: 72)
Ò # prime factorization ([2, 2, 2, 3, 3])
ā # indices ([1, 2, 3, 4, 5])
¨ …
3
votes
Find all \$k\$-smooth pairs
Explanation:
° # 10 ** the input
Lü‚ # list of pairs up to that number
ʒ # filtered by...
fà # the greatest prime factor (of either element of the pair)... …
3
votes
Whole-number powers
05AB1E, 3 bytes
Ó¿Ñ
Try it online!
Port of Unrelated String’s Jelly answer.
Ó # exponents in the prime factorization
¿ # gcd
Ñ # divisors
2
votes
Accepted
Distributing parliament seats
D{ # sorted copy of the ratios
®1% # fractional votes mod 1 (aka the decimal parts)
O # sum of the above (this is the number of bonus seats)
ò … # round to nearest (required due to floating point bs)
è # index into the sorted ratios
This gives us the (n+1)th best ratio, where n is the number of bonus seats (+1 because indexing …
5
votes
Simplification of numbers
05AB1E, 16 14 bytes
-1 byte thanks to Kevin Cruijssen
₆LBāøΣнDÙìg}1è
Try it online!
Or add R)» at the end to conform exactly to the specified output format, but most other answers didn't bother.
…
2
votes
Calculate the Ultraradical
05AB1E, 12 bytes
ΔyIy4m>/+5/-
Try it online!
Newton's method.