Syntactic Confectionery Delight PerlMonks

### How many different varieties (color, size, etc) of socks do you have in your sock drawer?

by Pope-O-Matik (Pilgrim)
 on Oct 01, 2016 at 17:36 UTC ( #1173090=poll: print w/replies, xml ) Need Help??

vote on How many different varieties (color, size, etc) of socks do you have in your sock drawer?

 1. Keep it simple 165/41% 2. Just remember to pull out 3 in the morning 50/12% 3. A good puzzle will wake me up 26/6% Many. I like to torture myself 124/31% 0. Socks just get in the way 40/10% 405 total votes
• Comment on How many different varieties (color, size, etc) of socks do you have in your sock drawer?
Replies are listed 'Best First'.
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by choroba (Bishop) on Oct 01, 2016 at 18:46 UTC
I roll them in pairs, so the problem appears in evenings, not mornings.

```(\$q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+\$1,++print+eval\$q,q,a,
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by jaredor (Priest) on Oct 02, 2016 at 06:37 UTC

Zero, there are no sock drawers in the house. However, there is a communal sock basket, which is because no one will fold socks.

• With teenage females, the number of different pairings will explode combinatorially because brightly colored socks are a thing, but matching the socks aren't. (Admittedly, my sample size is one on this.)
• There is a Gresham's Law for socks: When two or more people share the same size feet and prefer the same style socks, the good socks will be squirreled away somewhere safe and the bad socks (holes, bad fabric, limp elastic, etc.) will remain in the common basket.
• The amount of socks in a common sock basket scales linearly with the number of people living in the house; however, this relationship holds even if some of the inhabitants habitually wear open-toed shoes and sandals. There is ongoing research to explain this paradox.
• Another phenomenon observed is that large collections of socks will attract "miscellaneous items that have been washed". This leads me to the following conjecture: As the number of socks in the sock drawer increases, so does the likelihood that the sock drawer contains things that are not socks. Alas, since I don't possess a sock drawer I can only theorize in this area, but if this conjecture is found to be true I claim it to be counter-intuitive, since fewer socks should leave more room for other junk. Left for the philosophers is a related question: How many non-socks does it take before "a sock drawer" becomes "not a sock drawer"? Kind of a Ship of Theseus flavored conundrum.

The ship of Theseus, also known as Theseus' paradox, is a thought experiment that raises the question of whether an object that has had all of its components replaced remains fundamentally the same object.
I just realised that the well-read Larry was probably aware of this philosophical teaser when he wrote:
Seriously, what makes Perl Perl? If someone decides I'm ugly and beats my face to a pulp, and later I get a face transplant, am I still me? If my bones rot and are replaced with synthetics, at what point am I a different person? Syntax is just skin. Semantics are just bones. Neither is the soul of Perl, which rests in the realm of pragmatics.

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by atcroft (Abbot) on Oct 01, 2016 at 17:43 UTC

There are only two attributes that matter: \$sock->has_similar_match and \$sock->percent_intact. The rest of the attributes are just not that important (especially when you primarily wear boots), and only useful for doing certain queries. :)

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by eyepopslikeamosquito (Chancellor) on Oct 01, 2016 at 22:16 UTC

Curiously, from our early Perl Monk history, the only personal information known of cinder_bdt, the mysterious second non-insider to join the Perl Monks web site (on Dec 23 1999 22:49 UTC), relates to his socks:

When I buy socks, I throw all my old ones out and buy 21 new pairs. Here's my favorite high school math word problem:
• Q: If you have blue socks, red socks and white socks, what is the smallest number greater than 0 of socks that you have to pull out of your drawer to get a pair?
• A: n+1 where n is 3 because you have 3 different colors.
Well, this way I only ever have to touch two socks!
It's nice that he's still remembered and revered today even though he has not visited us for eleven years now (last here Jun 15, 2005 14:39 UTC). I wonder what he is doing with his socks today and if he will ever return to join us once again.

Update: Further googling suggests cinder_bdt may have moved to Alaska, in which case he will need more socks to prevent frost-bitten toes.

He was wrong, of course. You could pull out a pair on the first try. And pulling 4 socks only guarantees at least one pair if you have exactly 1 pair of each color. The question, as stated, had no information about how many pairs.

He's wrong because the question doesn't ask for a matched pair, so the correct answer is two.

Interesting -- 21 new pairs, but are they split equally among the three colours? Discuss. :)

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

21 new pairs, but are they split equally among the three colours?

21 is Blackjack. Black is a pigment made from other colors, which could be three.

A blackjack can also cause you to see colors before blacking out.

I'm glad to have contributed! (Or something like that. 8^P )

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by BrowserUk (Pope) on Oct 01, 2016 at 19:28 UTC

9316 pairings. A couple of pairs for my rare formal occasions, and 97 odd ones that can be paired any way they come out!

I might have known you would have them by the terabyte!

I friend of mine got so sick of trying to match similar shades that he threw them all out and bought very bright colours in checks he now wears whatever comes out first regardless of match telling me he is making a fashion statement!

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by Tux (Abbot) on Oct 02, 2016 at 14:00 UTC

All my socks, both two types of "normal" socks, my white badminton sporting socks, and several bright-colored skiing sock pairs do not just come in pairs: they are all seamless and have a right-fit and a left-fit. All these math riddles assume left and right socks to be equal.

Enjoy, Have FUN! H.Merijn
they are all seamless and have a right-fit and a left-fit.

You can turn a left-fit into a right-fit and vice versa, if you treat them as Inside-Out-Objects. More math ;-)

perl -le'print map{pack c,(\$-++?1:13)+ord}split//,ESEL'
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by FloydATC (Deacon) on Oct 04, 2016 at 18:46 UTC

Not sure if this files under "1st World Problems" or "Grow a pair already" but I just have to vent. Here goes...

I used to be able to say "1". Those were happy days. Half asleep, I would stumble up to the sock drawer and just fetch TWO SOCKS.

Then my wife started picking up all of these random socks on sale every god knows where, and to make matters worse she noticed that all of my socks were black and so she figured "well he obviously likes them black" and kept buying all these different types of black socks. None of them match, they all have different seams or patterns woven into them or .... well... they're all DIFFERENT okay?!

Now I stumble up to the sock drawer and have to pick out atleast two dozen of the damned things AND scavenge both the dryer and the occasional hamper just to find a single matching pair. If I was any less OCD I would probably just go "hey, they're all black, nobody can tell if they're a match" but I would know and it would drive me crazy. (Which, by my own standard, I am currently not.)

One of these days I swear I'll just dump them all in the garbage or hide them somewhere in the back of the garage to use as rags and then buy 200 pairs of identical black socks but I just know I'll be in so much trouble and so I've been putting it off...

-- FloydATC

Time flies when you don't know what you're doing

I'm with you!

I literally only buy 1 color of socks -- a light gray. They're fine for casual or semi-formal, as well as any kind of exercise. I never have to look for a match, or try to decide what color pair I want to wear. And every few years I buy 3 or 4 (or more) packs of the same to replenish my stock.

Best of all, if I lose one sock, I never miss it; same thing if one sock gets a hole and has to be tossed. So socks technically cost me half of what they cost everyone else :)

s''(q.S:\$/9=(T1';s;(..)(..);\$..=substr+crypt(\$1,\$2),2,3;eg;print\$..\$/
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by talexb (Canon) on Oct 06, 2016 at 18:09 UTC

A bit of an academic question for me right now -- I've been wearing sandals (without socks, naturally) since June, as I ride my bike to work. I brought socks and shoes into the office, but I have never worn them -- I just keep my sandals on all day long.

I used to pair up my socks after laundry, but lately I just toss all of the dark socks into the sock drawer and pull out two and wear them. The odds that someone's going to notice that I have mis-matched socks is low, and the chance that I care about this discovery is even lower. :)

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by sweetblood (Prior) on Oct 06, 2016 at 18:51 UTC
I have ONLY black gold toe socks, nothing else!

Sweetblood

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by shmem (Chancellor) on Oct 02, 2016 at 14:12 UTC

Who needs socks if he's got sane feet? asks the bare footed monk

perl -le'print map{pack c,(\$-++?1:13)+ord}split//,ESEL'
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by QM (Parson) on Oct 16, 2017 at 11:13 UTC
I have exactly 2 colors of socks. Black for work and "fancy" stuff, white for exercise and kicking about. Both of these could be classed as "athletic", though you would be hard-pressed to identify the black ones as such.

Socks are folded in half, in singles. They are "stacked" edge up in a drawer insert (little Ikea box for drawers). Fresh socks are placed at the back. Socks are picked from the front (making this a FIFO), keeping the wear even across the batch.

Once or twice a year, I visit my discount sports store, which sells these in bundles of 6 pairs. I buy 2 bundles of each color. New socks replace all old socks (this is best done on laundry day, so all old socks are in one place, and binned all at once).

Matching socks is easy, even in the dark of winter at 6am.

I admit to having some spares, because the store-bought bundles don't fit into the drawer boxes exactly, and I don't really need that many in rotation.

I have much more interesting things to do on laundry day or every morning than match socks.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Matching socks is easy, even in the dark of winter at 6am.

This may explain the origin of some monks' love of combinatorics ...

The way forward always starts with a minimal test.
This may explain the origin of some monks' love of combinatorics ...

I would have thought the opposite, at least in my case. There is almost no chance of getting a mixed pair, drawing 2 socks, even in the dark. It's still light enough to make out white vs. black, and each color is in its own box. "Two from this box" is all it takes.

But perhaps you meant the opposite...

-QM
--
Quantum Mechanics: The dreams stuff is made of

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by runrig (Abbot) on Oct 07, 2016 at 22:29 UTC
I have TWO sock drawers you insensitive clod! (one for white, one for dark socks...the dark socks might not completely match, but are close enough, as they're dark).
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by papidave (Pilgrim) on Oct 13, 2016 at 19:13 UTC
I am too financially conservative (read: cheap) to discard socks unnecessarily. To avoid this, I always purchase N>1 pairs of identical socks at a time, thereby insuring that I will always have N-1 pairs of usable socks even after the second sock of a particular variety becomes dryer food (or gets a hole).

I also don't discard old, valid pairs of socks when I buy a new batch, so I end up with K>>1 varieties of socks in the drawer. Still, for any drawer containing M pairs of socks, we typically find that K < M/2, and often much smaller than that.

Inasmuch as my socks are typically worn, washed, and stored in pairs, the whole question of pulling more than one matching sock in the morning never comes up. Besides that question has already been solved, so today I can simply use socks; and leave the actual counting as an exercise for the grad students. Matching those socks to my outfit in the dark, however, remains NP-hard.

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by Dallaylaen (Chaplain) on Oct 06, 2016 at 16:33 UTC
```SELECT l.sock, r.sock
FROM socks r, socks l
WHERE l.sock LIKE r.sock and l.sock <> r.sock
LIMIT 1;

That code makes no sense. LIKE without a wildcard means equals, so the two conditions cancel each other out. Unless sock means color, in which case it would at best tell you what you have a set of. But for that, it would be much clearer to write:

```SELECT sock
FROM socks
GROUP BY sock
HAVING COUNT(*) > 1
LIMIT 1;

Of course, that completely ignores ids (which sock) and the state of the sock. At the very least, you ought to check for State = 'Washed' or MIN(Times_Worn).

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by wjw (Priest) on Oct 09, 2016 at 10:59 UTC

I will be damned! There is someone else who wears only black colored Gold Toe socks!?!

And here I was thinking I was so special!

...the majority is always wrong, and always the last to know about it...

A solution is nothing more than a clearly stated problem...

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by xaphod (Monk) on Oct 28, 2016 at 11:47 UTC
All socks are odd (can you tell a left-hand sock from a right-hand sock?) I therefore choose to make this oddness explicit by wearing non matching socks... unless by some chance I pull a matching pair from the sock pile...
--
TTFN, FNORD

xaphod
Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by eighty-one (Curate) on Oct 25, 2016 at 15:27 UTC
Kohls stopped carrying my standard sock, so I'm gonna have a problem for a while until all of the old standard socks wear out and get completely replaced with the new ones

When my socks get holes (that are large enough) i throw them out. When i throw enough out, i go to the store and buy 30 more, and throw out all the current ones. Why wait?

Re: How many different varieties (color, size, etc) of socks do you have in your sock drawer?
by choroba (Bishop) on Oct 28, 2016 at 21:08 UTC
Related: Oddsockeaters. I hope they'll make an English version, too.

```(\$q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+\$1,++print+eval\$q,q,a,

View List Of Past Polls

Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2019-10-21 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In 2019 the site I miss most is:

Results (51 votes). Check out past polls.

Notices?