text:
World IPv6 day 2014
To mark the anniversary of World IPv6 day, the Internet Society has published a campaign to Turn Off IPv4 on 6 June 2014 for One Day.

IPv6 addresses may be represented in their long form as eight colon-separated 16-bit hex values.  Depending on the address, they may also be shortened as described in item 2 of section 2.2 Text Representation of Addresses of RFC 3513:

In order to make writing addresses containing zero bits easier a special syntax is available to compress the zeros.  The use of "::" indicates one or more groups of 16 bits of zeros.  The "::" can only appear once in an address.  The "::" can also be used to compress leading or trailing zeros in an address.

Entries to this challenge will be programs that accept exactly one IPv6 address formatted in either the long or shortened format, and will display the same address in both the long and short formats, in that order.

The input may come from command-line arguments, STDIN, or any other input source that suits your choice of language.

Libraries or utilities specifically for parsing IPv6 addresses are banned (e.g. inet_{ntop,pton}()).

If the input address is invalid, the output will be empty (or some suitable error message indicating the address is invalid is given)

In cases where :: shortening occurs, only one shortening operation may happen for a given address.  If there are more than one potential shortening operations for a given address, the operation that gives the overall shortest address must be used.  If there is a tie in this regard, the first operation will be used.  This is illustrated in the examples below.

Standard loopholes to be avoided

Examples:
Input                         Output

1080:0:0:0:8:800:200C:417A    1080:0:0:0:8:800:200C:417A
                              1080::8:800:200C:417A

FF01::101                     FF01:0:0:0:0:0:0:101
                              FF01::101

0:0:0:0:0:0:0:1               0:0:0:0:0:0:0:1
                              ::1

::                            0:0:0:0:0:0:0:0
                              ::

1:0:0:2:0:0:0:3               1:0:0:2:0:0:0:3
                              1:0:0:2::3

1:0:0:8:8:0:0:3               1:0:0:8:8:0:0:3
                              1::8:8:0:0:3

1:2:3:4:5:6:7:8               1:2:3:4:5:6:7:8
                              1:2:3:4:5:6:7:8

ABCD:1234                     <Invalid address format - no output>

ABCDE::1234                   <Invalid address format - no output>

1:2:3:4:5:6:7:8:9             <Invalid address format - no output>

:::1                          <Invalid address format - no output>

codegolf puzzle               <Invalid address format - no output>

This is codegolf, so the shortest answer in bytes on June 6th 2014 will be accepted as the winner.

Say the input is 1:0:0:2:2::3. Would the shortened output be identical to that or 1::2:2:0:0:3? Same for non-optimally shortened input.

@m.buettner In this case, I'll let you pick either.

Is 1::2:0:0:0:3 a possible input?

@ace In accordance with the late great Jon Postel's Robustness principle, yes.

I think this is the only way anyone's ever going to get me to learn ipv6. +1

Can we just uncontrollably crash on malformed input?

@NickT Only if the result of the crash is no output or a suitable error message about the invalid address format.  Otherwise, no ;-)

What should the short form second line output be for 1:2:3:4:5:6:7:8? There is no legal place to put ::.

@MtnViewMark If a long-form address cannot be shortened, then the long and short forms are identical.

Should we support IPv4-mapped IPv6 addresses like ::ffff:74.125.136.101? Should we support link-local addresses like fe80::1%eth0?

@Vi. No, don't bother with ipv4-in-ipv6 formats.

JavaScript (ES6) - 198, 183, 180, 188, 187 bytes
f=s=>/^(:[\da-f]{1,4}){8}$/i.test(':'+(s=s[r='replace'](d='::',':0'.repeat((n=8-s.split(/:+/).length%9)||1)+':')[r](/^:0|0:$/g,n?'0:0':0)))&&[s,s[r](/(\b0(:0)*)(?!.*\1:0)/,d)[r](/::+/,d)]

And, a bit longer, interactive version with some pop-ups (203 bytes):
/^(:[\da-f]{1,4}){8}$/i.test(':'+(s=(s=prompt())[r='replace'](d='::',':0'.repeat((n=8-s.split(/:+/).length%9)||1)+':')[r](/^:0|0:$/g,n?'0:0':0)))&&alert(s+'\n'+s[r](/(\b0(:0)*)(?!.*\1:0)/,d)[r](/::+/,d))

Ungolfed:
function ipv6(str) {
    "use strict";
    var zeros = 8 - str.split(/:+/).length % 9

        ,longIP = str
            .replace('::', ':0'.repeat(zeros || 1) + ':')
            .replace(/^:0|0:$/g, zeros ? '0:0' : '0')

        ,shortIP = longIP
            .replace(/(\b0(:0)*)(?!.*\1:0)/,':')
            .replace(/::+/,'::');

    return /^(:[\da-f]{1,4}){8}$/i.test(':'+longIP) && [longIP, shortIP];
}

Explanation:
To calculate the long version of the IPv6 address:
8 - str.split(/:+/).length % 9 - calculate how many zeros we need to insert. They are 8 - the number of the hex values. Here % 9 is a guard so it will never be a negative number.
replace('::', ':0'.repeat(zeros || 1) + ':') - replace the "::" with colon separated zeros. If there are no zeros to add it still adds one so the address won't be valid in the end
replace(/^:0|0:$/g, zeros ? '0:0' : '0') - this deals with the special case when the address starts or ends with "::" as the split function adds 1 to the number of hex values (::1 -> ["", "1"])
That's it! Now let's calculate the short form:
replace(/(\b0(:0)*)(?!.*\1:0)/,':') - replace longest row of zeros with colon(s) (It doesn't matter how many).
replace(/::+/,'::') - remove the extra colons if any
return /^(:[\da-f]{1,4}){8}$/i.test(':'+longIP) && [longIP, shortIP]; - test if the long version is valid IPv6 and return both versions or false if the test fails.
Tests in Firefox:
>>> f('1080:0:0:0:8:800:200C:417A')
["1080:0:0:0:8:800:200C:417A", "1080::8:800:200C:417A"]
>>> f('FF01::101')
["FF01:0:0:0:0:0:0:101", "FF01::101"]
>>> f('0:0:0:0:0:0:0:1')
["0:0:0:0:0:0:0:1", "::1"]
>>> f('::')
["0:0:0:0:0:0:0:0", "::"]
>>> f('1:0:0:2:0:0:0:3')
["1:0:0:2:0:0:0:3", "1:0:0:2::3"]
>>> f('1:0:0:8:8:0:0:3')
["1:0:0:8:8:0:0:3", "1::8:8:0:0:3"]
>>> f('1:2:3:4:5:6:7:8')
["1:2:3:4:5:6:7:8", "1:2:3:4:5:6:7:8"]
>>> f('ABCD:1234')
false
>>> f('ABCDE::1234')
false
>>> f('1:2:3:4:5:6:7:8:9')
false
>>> f(':::1')
false
>>> f('1:2:3:4::a:b:c:d')
false
>>> f('codegolf puzzle')
false

So much better than mine! Just needs some correction to handle input like this ::1:, :1::

This one accepted the invalid 1:2:3:4::a:b:c:d

Javascript (E6) 246 305 284 292 319
Heavily revised
Special case for :: specifically handled, compress phase avoids the for loop (but not very shorter indeed)
I'm sure that the final compress phase can be made shorter. Not now anyway
F=i=>(c=':',d=c+c,z=':0'.repeat(9-i.split(c,9).length)+c,i=i==d?0+z+0:i[R='replace'](/^::/,0+z)[R](/::$/,z+0)[R](d,z>c?z:d),/^(:[\da-f]{1,4}){8}:$/i.test(k=c+i+c)&&[i,k[R]((k.match(/:(0:)+/g)||[]).sort().pop(),d)[R](/^:([^:])|([^:]):$/g,'$1$2')])

Thanks to nderscore
As a program
Input and output using js popup, basically: p=prompt,p(F(p()))
Rewriting with popup and without the function definition, the char count should be under 260
Ungolfed
and commented a bit
F = i => (
  c = ':',
  d = c+c,
  z = ':0'.repeat(9-i.split(c,9).length) + c,
  i = i == d ? 0+z+0 /* special case '::' */
    : i.replace(/^::/,0+z) /* special case '::...' */
       .replace(/::$/,z+0) /* special case '...::' */
       .replace(d, z > c ? z : d), /* here, if z==c, not valid: too much colons */
  /^(:[\da-f]{1,4}){8}:$/i.test(k = c+i+c) /* Check if valid */
  && [
   i,
   k.replace((k.match(/:(0:)+/g)||[]).sort().pop(),d) /* find longest 0: sequence and replace it */
    .replace(/^:([^:])|([^:]):$/g,'$1$2') /* cut leading and trailing colons */
  ]
)

Test
In console
i=['1080:0:0:0:8:800:200C:417A'
, '::1:2:3:4:5:6:7', '1:2:3:4:5:6:7::'
, '1:2:3:4::5:6:7:8'
, ':1:2:3:4:5:6:7', '1:2:3:4:5:6:7:'
, 'FF01::101', '0:0:0:0:0:0:0:1'
, '::', '1::', '::1', ':::1', '1:::'
, '1:0:0:2:0:0:0:3', '1:0:0:0:2:0:0:3', '1::8:0:0:0:3'
, '1:2:3:4:5:6:7:8'
, 'ABCD:1234', 'ABCDE::1234', ':::', '::::::::::'
, '1:2:3:4:5:6:7:8:9', '::::1', 'codegolf puzzle'];
i.map(x=>x+' => '+F(x)).join('\n')

Test output
"1080:0:0:0:8:800:200C:417A => 1080:0:0:0:8:800:200C:417A,1080::8:800:200C:417A
::1:2:3:4:5:6:7 => 0:1:2:3:4:5:6:7,::1:2:3:4:5:6:7
1:2:3:4:5:6:7:: => 1:2:3:4:5:6:7:0,1:2:3:4:5:6:7::
1:2:3:4::5:6:7:8 => false
:1:2:3:4:5:6:7 => false
1:2:3:4:5:6:7: => false
FF01::101 => FF01:0:0:0:0:0:0:101,FF01::101
0:0:0:0:0:0:0:1 => 0:0:0:0:0:0:0:1,::1
:: => 0:0:0:0:0:0:0:0,::
1:: => 1:0:0:0:0:0:0:0,1::
::1 => 0:0:0:0:0:0:0:1,::1
:::1 => false
1::: => false
1:0:0:2:0:0:0:3 => 1:0:0:2:0:0:0:3,1:0:0:2::3
1:0:0:0:2:0:0:3 => 1:0:0:0:2:0:0:3,1::2:0:0:3
1::8:0:0:0:3 => 1:0:0:8:0:0:0:3,1:0:0:8::3
1:2:3:4:5:6:7:8 => 1:2:3:4:5:6:7:8,1:2:3:4:5:6:7:8
ABCD:1234 => false
ABCDE::1234 => false
::: => false
:::::::::: => false
1:2:3:4:5:6:7:8:9 => false
::::1 => false
codegolf puzzle => false"

I'd rather a program than a function. I don't know javascript well enough to know if this is possible.

@nderscore Oops - typo.  Corrected in a new comment.

It could be made into a program by taking input from prompt(). Here are some optimizations that bring it down to 290: http://pastie.org/private/3ccpinzqrvvliu9nkccyg

@nderscore: thx, the 1st replace does not work for input = '::', great work anyway!

@edc65 I found a fix for that replace :) http://pastie.org/private/kee0sdvjez0vfcmlvaxu8q

Actually, that might not work. Seems it fails for this invalid address: :1:2:3:4:5:6:7 :(

@nderscore problem with my original code too. Now I reached 284 but still can't compete against perl :(

This one rejected the valid addresses ::2:3:4:a:b:c:d and 1:2:3:4:a:b:c::

Perl - 204 176 190 191 197
(202 chars + 2 for -p flag)
$_=uc;(9-split/:/)||/^:|:$/||last;s/^::/0::/;s/::$/::0/;s|::|':0'x(9-split/:/).':'|e;/::|^:|:$|\w{5}|[^A-F0-:].*\n/||(8-split/:/)and last;s/\b0*(?!\b)//g;print;s/\b((0:)*0)\b(?!.*\1:0\b)/::/;s/::::?/::/

Example:
$ perl -p ipv6.pl <<< 1:0:2:0::3
1:0:2:0:0:0:0:3
1:0:2::3
$ perl -p ipv6.pl <<< somethinginvalid
$ perl -p ipv6.pl <<< 1:2:0:4:0:6::8
1:2:0:4:0:6:0:8
1:2::4:0:6:0:8

Explanation:
# -p reads a line from stdin and stores in $_
#
# Convert to uppercase
$_ = uc;

# Detect the annoying case @kernigh pointed out
(9 - split /:/) || /^:|:$/ || last;

# Fix :: hanging on the beginning or the end of the string
s/^::/0::/;
s/::$/::0/;

# Replace :: with the appropriate number of 0 groups
s|::|':0' x (9 - split /:/) . ':'|e;

# Silently exit if found an extra ::, a hanging :, a 5-char group, an invalid
# character, or there's not 8 groups
/::|^:|:$|\w{5}|[^A-F0-:].*\n/ || (8 - split /:/) and last;

# Remove leading zeros from groups
s/\b0*(?!\b)//g;

# Output the ungolfed form
print;

# Find the longest sequence of 0 groups (a sequence not followed by something
# and a longer sequence) and replace with ::
# This doesn't replace the colons around the sequence because those are optional
# thus we are left with 4 or 3 colons in a row
s/\b((0:)*0)\b(?!.*\1:0\b)/::/;

# Fix the colons after previous transformation
s/::::?/::/

# -p then prints the golfed form of the address

"Died at ipv6.pl line 1, <> line 1".  This was asked about in the question comments.  If there is a message, it must be clear that it is because of an invalid message.  I tried to clarify that in the question.  Otherwise looks good!

@DigitalTrauma Changed die to a silent exit.

A bug? This program accepts the invalid address 1:2:3:4::a:b:c:d. This is an annoying special case, because most eight-colon addresses are invalid, but ::2:3:4:a:b:c:d and 1:2:3:4:a:b:c:: are both valid.

sed, 276
I have 275 bytes in ipshorten.sed, plus 1 byte for the -r switch in sed -rf to use extended regular expressions. I used OpenBSD sed(1).
Usage: echo ::2:3:4:a:b:c:d | sed -rf ipshorten.sed
s/^/:/
/^(:[0-9A-Fa-f]{0,4})*$/!d
s/:0*([^:])/:\1/g
s/://
s/::/:=/
s/(.:=)(.)/\10:\2/
s/^:=/0&/
s/=$/&0/
:E
/(.*:){7}/!{/=/!d
s//=0:/
bE
}
s/=//
/^:|::|:$|(.*:){8}/d
p
s/.*/:&:/
s/:((0:)+)/:<\1>/g
:C
s/0:>/>0:/g
/<0/{s/<>//g
bC
}
s/<>(0:)+/:/
s/<>//g
/^::/!s/://
/::$/!s/:$//

I use 22 regular expressions, as sed can't compare numbers or make arrays. For each line of input, sed runs the commands and prints the line. During testing, I put several lines of alleged IP addresses in a file, and fed this file to sed. A reference to extended regular expressions is in re_format(7).

s/^/:/ adds an extra colon to the beginning of the line. I use this extra colon to golf the next two commands.
/^(:[0-9A-Fa-f]{0,4})*$/!d checks if the whole line matches zero or more groups of colons followed by zero to four hexadecimal digits. ! negates the check, so d deletes lines with too big hexadecimal numbers or with invalid characters. When d deletes a line, sed runs no more commands on this line.
s/:0*([^:])/:\1/g deletes leading 0s from each number. It would change :0000:0000: to :0:0:. I must do this because my contraction loop only works with single-digit 0s.
s/:// deletes the extra colon. It deletes only the first colon.
s/::/:=/ changes the first :: to :=. This is so later commands can match = rather than ::, and so = does not count as a colon. If there is no ::, this substitution safely does nothing.

Now :: must make at least one 0, but there are three different cases for placing this 0.

s/(.:=)(.)/\10:\2/ is the first case. If :: was between two other characters, then := becomes :=0:. This is the only case that adds a colon.
s/^:=/0&/ is the second case. If :: was at beginning of line, then put 0 there.
s/=$/&0/ is the third case, for :: at end of line.
:E is the label for the expansion loop.
/(.*:){7}/!{/=/!d begins a conditional block if the line has fewer than 7 colons. /=/!d deletes lines that had no :: and not enough colons.
s//=0:/ adds one colon. Empty // repeats the last regular expression, so this is really s/=/=0:/.
bE branches to :E to continue the loop.
} closes the block. Now the line has at least seven colons.
s/=// deletes =.
/^:|::|:$|(.*:){8}/d is a final check after expansion. It deletes lines with a leading colon, an extra :: that was not expanded, a trailing colon, or eight or more colons.
p prints the line, which is an IP address in long form.
s/.*/:&:/ wraps the address in extra colons.

The next task is to find the longest group of 0s, like :0:0:0:, and contract it into ::.

s/:((0:)+)/:<\1>/g eats each group of 0s, so :0:0:0: would become :<0:0:0:>.
:C is the label for the contraction loop.
s/0:>/>0:/g moves one 0 from each mouth, so :<0:0:0:> would become :<0:0:>0:.
/<0/{s/<>//g opens a conditional block if any mouth is not empty. s/<>//g deletes all empty mouths, because those groups are too short.
bC continues the contraction loop.
} closes the block. Now any mouth is empty and marks the longest group of 0s.
s/<>(0:)+/:/ contracts the longest group, so :<>0:0:0: would become ::. In a tie, it picks the empty mouth on the left.
s/<>//g deletes any other empty mouths.
/^::/!s/:// deletes the first extra colon unless it is part of ::.
/::$/!s/:$// does so for the last extra colon. Then sed prints the IP address in short form.

Python 3: 387 characters
Even works with improperly shortened input.
$ echo '1::2:0:0:0:3' | python3 ipv6.py
1:0:0:2:0:0:0:3
1:0:0:2::3

The double replace of ':::' with '::' feels really bad but not sure how to cleanly deal with the longest string of 0's when it abuts one or both ends.
c=':'
p=print
try:
 B=[int(x,16)if x else''for x in input().split(c)];L=len(B)
 if any(B)-1:B=[''];L=1
 if L!=8:s=B.index('');B[s:s+1]=[0]*(9-L)
 for b in B:assert-1<b<2**16
 H=[format(x,'X')for x in B];o=c.join(H);p(o);n=''.join(str(h=='0')[0]for h in H)
 for i in range(8,0,-1):
  s=n.find('T'*i)
  if s>=0:H[s:s+i]=[c*2];p(c.join(H).replace(c*3,c*2).replace(c*3,c*2));q
 p(o)
except:0

Replace the final pass with raise to see how it's crashing protecting against malformed input.
$ cat ipv6-test.sh
echo '1080:0:0:0:8:800:200C:417A' | python3 ipv6.py
echo '1:2:3:4:5:6:7:8' | python3 ipv6.py
echo 'FF01::101' | python3 ipv6.py
echo '0:0:0:0:0:0:0:1' | python3 ipv6.py
echo '0:0:0:0:1:0:0:0' | python3 ipv6.py
echo '1:0:0:0:0:0:0:0' | python3 ipv6.py
echo '::' | python3 ipv6.py
echo '1:0:0:2:0:0:0:3' | python3 ipv6.py
echo '1::2:0:0:0:3' | python3 ipv6.py
echo '1:0:0:8:8:0:0:3' | python3 ipv6.py
echo 'ABCD:1234' | python3 ipv6.py
echo 'ABCDE::1234' | python3 ipv6.py
echo '1:2:3:4:5:6:7:8:9' | python3 ipv6.py
echo ':::1' | python3 ipv6.py
echo 'codegolf puzzle' | python3 ipv6.py
$ ./ipv6-test.sh
1080:0:0:0:8:800:200C:417A
1080::8:800:200C:417A

1:2:3:4:5:6:7:8
1:2:3:4:5:6:7:8

FF01:0:0:0:0:0:0:101
FF01::101

0:0:0:0:0:0:0:1
::1

0:0:0:0:1:0:0:0
::1:0:0:0

1:0:0:0:0:0:0:0
1::

0:0:0:0:0:0:0:0
::

1:0:0:2:0:0:0:3
1:0:0:2::3

1:0:0:2:0:0:0:3
1:0:0:2::3

1:0:0:8:8:0:0:3
1::8:8:0:0:3

@DigitalTrauma corrected.  I was searching for "0:0:0..." and it was capturing trailing 0's

You really don't hear the word "abuts" enough nowadays

A bug? This program accepted 1:2:3:4::a:b:c:d but rejected both ::2:3:4:a:b:c:d and 1:2:3:4:a:b:c::. I believe it was wrong all three times.


text:
Find number of polynomials with a root which is a root of unity
Write a program which takes an integer argument and outputs the number of degree n monic polynomials with coefficients that are -1,1 or 0 which have a root which is a root of unity.   To make it a little cleaner, only count polynomials with leading coefficient of 1.
You can use any language you like as long as it is freely available and the interpreter/compiler is open source. You can use the standard libraries of the language you choose but no tools specifically designed to solve this problem.
Your score is simply the length of your code.
Tests

For n = 1,2,3,4,5,6,7,8 the output should be 2,6,12,36,94,
  276,790.

Degree two polynomials with a root which is a root of unity.

x^2-1,x^2-x, x^2+x, x^2-x+1, x^2+1, x^2+x+1

There was a bug in my numbers above and so I have just copied Peter Taylor's until I find out how to fix it.

And I see 32 such degree 3 polynomials one of whose roots is a root of unity (20 if 0*x^3 doesn't count).

@DavidHammen Yes I get the same numbers as you do. (Ignoring the leading coefficient being zero, because I think by definition of an nth order polynomial, the nth coefficient is non-zero.)

I was off on my count. I count four first order polynomials that match the criteria: 1x+1, 1x-1, -1x+1, and -1x-1. All of these are also second degree polynomials (with a leading coefficient of zero), plus 12 more with a leading coefficient of +1 or -1, making 16 second order polynomials that match the criteria.

Do you agree with my degree two list (just added to the question)?

@m.buettner - How did you get 8 order two proper polynomials? There are six monic second order polynomials that satisfy the criteria: x^2+1, x^2-1, x^2+x, x^2-x, x^2+x+1, and x^2-x+1. There are six more if the leading coefficient can also be -1.

@Lembik - It appears you are looking at monic polynomials, where the leading coefficient is one.

@DavidHammen Yes thank you. I have added clarification to the question. Do you agree with my numbers now?

@Lembik I don't see x²+x-1 having roots that are roots of unity. The roots seem to be -1.618... (-φ) and 0.618... (1/φ).

Did you mean x²-x+1?

Hm, I still get different results for larger n. In particular, 36, 276, 790 and 2267 for n = 4, 6, 7, 8. I might still be doing something wrong though.

@m.buettner Thanks. I did mean x²-x+1 .

GolfScript (111 107 chars)
~3\?:k,{2k*+3base{(}%:P,.*,{,{!}%-1+P{.,2$,>!{\[.0={*}+2$%\2$0={*}+%\]zip{{-}*}%\}*\0:x;{x|:x},.}do;,(},},,

Note: I disagree with some of the given test cases: I get
input   output
   1         2
   2         6
   3        12
   4        36
   5        94
   6       276
   7       790
   8      2270
   9      6412
  10     18334

Theory
Every algebraic number \$a\$ over a field \$F\$ has a minimal polynomial which is a factor of any polynomial \$P\$ in \$F[x]\$ for which \$P(a) = 0\$. For every integer \$n\$, the primitive \$n^\textrm{th}\$ roots of unity (those which are not roots of unity for any smaller \$n\$) share a minimal polynomial, the \$n^\textrm{th}\$ cyclotomic polynomial, whose degree is \$\varphi(n)\$.
So for input \$k\$ we can get an exact result by enumerating the possible functions and for each one looking for a non-trivial GCD with a cyclotomic polynomial of degree no greater than \$k\$.
There are two ways of doing that check: either by looping over the cyclotomic polynomials (or safe products thereof - e.g. \$x^n - 1\$ rather than the \$n^\textrm{th}\$ cyclotomic polynomial), or by multiplying them together and doing one GCD. My current approach is to take a very loose bound \$N = (k+1)^2\$ on the largest number whose totient is \$k\$ and then loop over \$x^i - 1\$. This is much faster than doing a single GCD with a massive polynomial, which can get some truly enormous intermediate values in the GCD, and I've managed to golf it ever so slightly more as well.
For speedier results at the cost of some characters, the bound can be improved moderately. Let \$M(n) = \max \{i : \varphi(i) = n\}\$. This has one major problem, which is that it's not well defined for odd \$n\$ greater than \$1\$ or for all even \$n\$. It also has the minor problem that it's not monotone. We need to use bound \$B(n) = \max \{i : \varphi(i) \le n\} = \max \{M(j) : j \le n\}\$.
H. Gupta defines \$A(n) = n \prod_{(p-1) \mid n} \frac{p}{p-1}\$ where \$p\$ prime and proves that \$M(n) \le A(n)\$. The bound is tight for \$n=1, 2, 8\$. Note that this is also not a monotone function: e.g. \$A(14) < A(12)\$.
We can modify the definition of \$A(n)\$ to get a looser bound which is monotone. First observe that since \$2 - 1\$ divides any integer, we can say that \$A(n) = 2n \prod_{(p-1) \mid n} \frac{p}{p-1}\$ where the \$p\$ must be odd primes. Then the number of multiplicands of the \$\prod\$ is bounded above by \$\log_3 (n+1)\$, and each multiplicand is bounded above by \$\frac32\$, so we get \$A(n) \le 2^{1 - \log_3 (n+1)} n(n+1)\$, and since this is monotone increasing for positive \$n\$ we also have \$B(n) \le 2^{1 - \log_3 (n+1)} n(n+1)\$. This bound overestimates by a factor of about \$2.5\$ at \$n=96\$, which isn't too shabby.
To use this bound, replace .* with ..(*2*2@3base,(?/). This is what I did to get the output for n=6 and n=7 in a reasonable amount of time.
More efficient calculation
;10,{
    )..).(*2*2@3base,(?/),{
        ):N,{!}%-1+
        N,0-{
            .N\%!{
                ~${
                    1$,\:Q,-),{
                        ;.0=\
                        [.0={*}+Q%]zip
                        {{-}*}%(;\
                    }%\
                }:^~;
            }{;}if
        }/
    }/]

    (\{,(1$)<},
    3@?:k,{
        2k*+3base{(}%[`{\^0-!*}+1$?]
    },
    ,p;
}/

prints the values for \$1\$ to \$10\$, taking about 8 minutes to get to \$8\$ and 125 minutes to get to \$10\$ on my computer. It applies the theory above more directly: it computes the actual cyclotomic polynomials (filtering to only include relevant ones), and then rather than doing GCD it suffices to do a division. Thus we replace a loop per (candidate, cyclotomic) tuple with a loop per cyclotomic, and makes the remaining division per (candidate, cyclotomic) work with smaller polynomials. It also has a quick-accept which speeds up testing for the successful candidates. I'm not sure whether it's possible to golf it to beat the GCD version, even ditching some of these optimisations.

I suppose I can't ask you if you get the same numbers as me then? :)

@Lembik, not quite.

Hm interesting, I get the same number as you for n = 4. I'd be really interested how your series continues, if you can get to speed up the performance. ;)

I added a full list for degree 4 to the question. I would be very interested to know which extra polynomial you have.

@Lembik, on the assumption that x^4+x^3x^2-1 in your list should be x^4+x^3-x^2-1, the one you're missing is x^4-x^2+1, the 12th cyclotomic polynomial.

@PeterTaylor now if you get 3 more than Lembik for n = 8, my solution was actually correct. ^^

Oh! Thank you. I should change my numbers to yours while I try to work out what I did wrong.

I need a golfscript->sane translator but this is very impressive :)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Find all numbers between 2 and 100 co-prime to a given number
Your program will be given a number as input. Your challenge is to output all the numbers between 2 and 100 inclusive that are co-prime to the given number. (Two numbers are co-prime if their GCD is 1.) If no numbers between 2 and 100 are co-prime to the given number, the program shall not output anything.
The program must receive the number from STDIN, and the output must be a list of numbers separated by a comma and a space.
Contest closes June 14th, 2014, two weeks from now. The shortest solution wins.
Examples (here the range is from 2 to 20):
3:
2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20

12:
5, 7, 11, 13, 17, 19

9699690:
(No output: no numbers between 2 and 20 are co-prime to 9699690).
EDIT: Esoteric languages (e.g. J or GolfScript) are now being assessed separately from non-esoteric languages. This is to make the challenge fair.

Why the time limit? Typically challenges on this site do not have a deadline or cutoff.

Also, most challenges don't really have an output/input spec. Are you sure that's really what you want?

@Synthetica All of these questions do, just to name a few: http://codegolf.stackexchange.com/questions/28801/missing-odd-numbers, http://codegolf.stackexchange.com/questions/28838/the-9-billion-names-of-god, and http://codegolf.stackexchange.com/questions/28345/destroy-them-with-lazers.

@Alex What I'm really trying to say here is that you might be a little tight on your restrictions. For example, one question you gave said in the assignment separated by any character not in the alphabet (newlines, semi-colons, whatever). vs. the output must be a list of numbers separated by a comma and a space.

Esoteric languages are now being assessed separately from non-esoteric languages. What does that mean? You can only accept one answer. Is the shortest solution going to win or is it not?

The shortest solution overall, in an esoteric language or not, is going to be accepted.

"Esoteric languages (e.g. J or GolfScript) [...]"--hold the phone. Brainfuck is esoteric. Unlambda is esoteric. J is a legitimate array processing language developed in the 90s as a successor to granddaddy APL, often used in research and other data-heavy fields.

@algorithmshark OK... what about "terse and unreadable"?

@algorithmshark What I meant that because J by nature produces much shorter programs than most other languages, it would not be fair to have it compete with non-esoteric languages: http://meta.codegolf.stackexchange.com/questions/286/j-and-golfscript-suck-all-the-enjoyment-out-of-code-golf

Your program will be given a number between 2 and 100 inclusive. Why the example with 9699690?

@Timtech My mistake, sorry! I removed the restriction on input.

Without the restriction, some of the answers existing answers won't work. My approach, for example, requires the input to smaller than 2**63.

@Dennis the input will of course be smaller than 2**31.

In that case, you don't have to specify what happens if there are no coprimes. The smallest integer that would cause empty output is the product of all primes less than 100, which is a 121-bit number (2305567963945518424753102147331756070).

-1 for time limit and for language segregation. :-(

CJam, 23 bytes
101,:N2>q~mf{N%-}/", "*

Try it online. Paste the Code, type an integer in Input and click Run.
Example
$ cjam factor.cjam <<< 210
11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

How it works
101,:N # Push the array [ 0 ... 100 ] and save it in “N”.
2>     # Remove 0 and 1 from the array.
q~mf   # Read from STDIN, interpret the input and factorize the resulting integer.
{      # For each prime factor:
  N%   # Collect all multiples of the prime factor in an array.
  -    # Apply set difference with the array on the stack.
}/     # This leaves only integers that are coprime with the input.
", "*  # Join by commas and spaces.

I get people not upvoting solutions in golfing languages, but downvoting them is a bit too much.

Haskell, 76 characters
main=do n<-readLn;putStrLn.drop 2$[show k|k<-[2..100],gcd k n<2]>>=(", "++)

GolfScript - 36
~:x;101,2>{.x{.@\%.}do;1>{;}*}%", "*

Explanation:
~ evaluates the input to a number
:x; assigns the number to variable x
101,2> makes an array [2 ... 100]
{...}% applies the block to each array element, resulting in a modified array
.x duplicates the current number (from 2 to 100) then pushes x
{.@\%.}do; calculates the gcd (see the GolfScript home page)
1> checks if the gcd was greater than 1
{;}* executes the block if the condition was true; the block (;) pops the current number from the stack, thus taking it out of the array
", "* joins the resulting array using the ", " separator

What does it do?

@JoeZ. I added an explanation

My CJam answer is competing with your GolfScript answer. Weird. :P

@Dennis I was gonna write it in CJam but I found a bug when trying to join an empty array (will fix in next release). That said, I hadn't thought of using a factorization :)

On the other hand, some people seem to hate both languages, we got downvotes :/

Python 2.7 - 87 bytes
from fractions import*
x=input()
print', '.join(`i`for i in range(2,101)if gcd(x,i)==1)

This is very similar to qwr's answer here, I shaved off some bytes but the changes were too substantial to fit in a comment. Full respect goes to them.
Modifications:

Removed unnecessary space in from fractions import * for one byte.
Moved the whole thing to python 2.7. I couldn't actually get the original answer to run on my machine because input() returns a string in python 3. The only thing that was specific to python 3 in the answer was defining the output format in the print function...
...which I changed anyway. The original answer looped through all the numbers and printed them out if the met the requirements. Here, I throw the whole thing in a generator function (with the output wrapped in backticks so we get a string) and join the numbers together, which saves bytes and means we don't have to use the "technically rules-valid" output format the original answer used (23 ,29 ,31 ,37... is a list of numbers separated by a comma and a space, but it doesn't waste any characters in my version to print out 23, 29, 31... like the OP was probably expecting).

Ruby, 52 46 (43 + 3 for " -p" option)
Now does beat it J (barely). Caveat: doesn't exit after outputting (you can actually keep giving more inputs after the first).
$_=(2..100).select{|w|w.gcd(eval$_)<2}*", "

Using a -p option saves you a gets call (the value is read into $_), and a puts (whatever $_ contains at the end is output).

Interactive mode isn't a caveat, it's a feature ;) (eof character will terminate input (^D linux, ^Z windows), or you can pipe from a file, or echo 9699690 | ruby -p script.rb it in).

Julia - 70 69 68 characters
i=int(readline());print(join(find([gcd(i,x)<2 for x=2:100])+1,", "))

Saved a character by using a list comprehension rather than a map, pretty much thanks to not needing the dotted .==. I suspect that I can do better, still.
Second edit saved another character by using <2 rather than ==1, as gcd can't produce a number less than 1 (except when both inputs are 0, which cannot happen with this code), and must produce an integer.
Old version:
i=int(readline());print(join(find(map(x->gcd(i,x),2:100).==1)+1,", "))

Note that int is Int64 (assuming a 64 bit machine), meaning that you can't actually have a number big enough to be non-coprime to every number between 2 and 100. To have it accept arbitrary-size integers, you need to replace int with BigInt, for a total of 73 characters.

Vyxal 3, 6 bytes
₅ḢΩ?ĠḂ

Try it Online!
RIP H flag

JavaScript (ECMAScript 6) - 82 Characters
g=(a,b)=>b?g(b,a%b):a;f=x=>[k for(y in[...Array(99)])if(g(x,k=+y+2)<2)].join(', ')

Explanation:
Firstly a recursive function g to calculate the gcd:
g=(a,b)=>b?g(b,a%b):a;

Secondly, a function f taking a single argument x:

Array(99) - Start with an uninitialised array of length 99.
[...Array(99)] - Use the ... spread operator to turn it into an array of 99 elements each initialised to undefined.
[+y+2 for(y in[...Array(99)])] - Use Array Comprehension to map the array of undefined values to an array of integers 2..100.
[k for(y in[...Array(99)])if(g(x,k=+y+2)<2)] - Add an additional restriction to only include those values where GCD(x,value) is 1.
.join(', ') - at the end return it as a comma-space delimited string to meet the requirement of outputting nothing if there are no matches.

Alternative
Taking input from a prompt (87 characters):
x=prompt(g=(a,b)=>b?g(b,a%b):a);[k for(y in[...Array(99)])if(g(x,k=+y+2)<2)].join(', ')

J (20):
Not quite complying with the rules as they are now, but hey... JS isn't either ;)
}.(1=a+.i.101)#i.101

Showcase:
   a=:3
   }.(1=a+.i.101)#i.101
2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25 26 28 29 31 32 34 35 37 38 40 41 43 44 46 47 49 50 52 53 55 56 58 59 61 62 64 65 67 68 70 71 73 74 76 77 79 80 82 83 85 86 88 89 91 92 94 95 97 98 100
   a=:12
   }.(1=a+.i.101)#i.101
5 7 11 13 17 19 23 25 29 31 35 37 41 43 47 49 53 55 59 61 65 67 71 73 77 79 83 85 89 91 95 97
   a=:9699690
   }.(1=a+.i.101)#i.101
23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Deconstruction:
Remember that J programs start at the back:
   i.101
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88...
   a=:12
   a+.i.101 NB. Takes GCD
12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4 1 6 1 4 3 2 1 12 1 2 3 4
   1=a+.i.101
0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0
   (1=a+.i.101)#i.101
1 5 7 11 13 17 19 23 25 29 31 35 37 41 43 47 49 53 55 59 61 65 67 71 73 77 79 83 85 89 91 95 97
   }.(1=a+.i.101)#i.101
5 7 11 13 17 19 23 25 29 31 35 37 41 43 47 49 53 55 59 61 65 67 71 73 77 79 83 85 89 91 95 97

17 char if you make it a train: }.a(]#~1=+.)i.101.

Javascript (ES5) - 92 91
This solution runs in the Spidermonkey commandline shell. It takes input from STDIN (as per the rules).
with([])for(a=readline(b=1);b++<99||print(join(', '));--c||push(b))for(c=a,d=b;d;)d=c%(c=d)

Here is a solution that runs in the browser console and takes input from prompt and outputs with alert: (89 bytes)
with([])for(a=prompt(b=1);b++<99||alert(join(', '));--c||push(b))for(c=a,d=b;d;)d=c%(c=d)

If implicit printing in the browser console is allowed, it can go even further: (82 bytes)
for(o=[],a=prompt(b=1);b++<99;--c||o.push(b))for(c=a,d=b;d;)d=c%(c=d);o.join(', ')

Haskell - 105
import Data.List
main=do
 x<-getLine
 putStrLn.intercalate", ".map show$filter((1==).gcd(read x))[2..100]

Quite obvious if you can understand Haskell. :)

Lua, 126
Now it's 2 times longer, but it actually works.
c=io.read()function g(a,b)return b~=0 and g(b,a%b) or tonumber(a) end for i=2,100 do if g(i,c)<2 then io.write(i,', ') end end

Lua, 63
Not much better, but still...
c=io.read()for i=2,100 do if i%c>0 then io.write(i,', ')end end

Lua, 64
c=io.read()for i=2,100 do if i%c>0 then io.write(i..', ')end end

Why the down-vote? I did everything required as far as I can tell.

I didn't cast the downvote, but the solution seems to be invalid. For example, 21 is not evenly divisible by 6, but they aren't co-prime either, as they are both divisible by 3.

Ah. My bad, I will see if I can fix that.

It is fixed, but very long.

Pyke, 9 bytes (noncompeting)
TXSt#.H1q

Try it here!
TX        -   10**2 (100)
  St      -  range(2, ^)
    #     - filter(^, V)
     .H   -   highest_common_factor(i, input)
       1q -  ^ == 1

Vyxal H, 44 bitsv2, 5.5 bytes
ɽḢ'?ġ1=

Try it Online!
Bitstring:
00100110011110110000000000001000100000100111

Because vyxal 3 is missing a lot of numerical operations :p

Vyxal, 34 bits2, 4.25 bytes: Ḣ'?ġṅ (vyncoded)

Japt, 7 bytes
Lõ ÅfjU

Try it here

Sage, 79
A boring answer, since I'm not in the mood of writing an interesting one.
l=[]
n=input()
for i in range(2,101):
 if gcd(i,n)==1:l+=[i]
print str(l)[1:-1]

Sample outputs:
sage: %runfile coprimelist.py
3
2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, 43, 44, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 100
sage: %runfile coprimelist.py
12
5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73, 77, 79, 83, 85, 89, 91, 95, 97
sage: %runfile coprimelist.py
9699690
23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
sage: %runfile coprimelist.py
factorial(100)

sage:

In the last example, it is supposed to print out nothing, but it prints [].

Of course it is.

No. But your edited code sample fixes that anyway.

@Alex I know, but I have a shorter code that does that.

python - 90
Boring answer. The output is a little strange (but meets the rules)
from fractions import *
x=input()
for i in range(2,101):
 if gcd(x,i)==1:print(i,",",end="")

Got this down to 87 bytes (as well as making it actually work), but the changes were pretty significant so I put them in their own answer here. If you want, you can copy those changes over and I'll delete that answer.

Shorten with import*

J - 47 char
Requiring input on STDIN (no trailing newlines, please) and outputting to STDOUT in proper form.
(2}.&;(2+i.99)(', ';":)&>@([#~1=+.)".)&.stdin''

2+i.99 is the integers from 2 to 100 inclusive. ([#~1=+.) keeps only those integers coprime to the input, and then (', ';":) converts each (&>) to a string and adds the comma and space before each entry. ; combined the entire result into a single string, and 2}. drops the comma and space before the first one.

ised (28)
ised '@1{6};' '?{{:gcd{x$1}:}@::[101]<2}\1'

The first argument is just setting the argument (6 in this case). The second evaluates the result.
With unicode, it's a bit shorter (26).
ised '@1{6};' '?{{:gcd{x$1}:}∷[101]<2}\1'

Unfortunately, the braces take up a lot of space in ised because it's not stack-based.

I haven't been able to find anything about ised anywhere. Could you please give me some background information about it?

@Alex It's not very well known but I'm using it as my calculator and data file processor and it's excellent for numerical golfing. http://ised.sourceforge.net/

Also, wouldn't your example be in shell script, not ised, since you're typing it at the terminal?

@Alex You can enter the same code interactively directly into ised. Two lines. The execution environment is irrelevant. At least from a unix point of view, there's no real difference. You are always in some kind of a terminal anyway just to provide the input file, pipe, stdin, output redirection... you could just as well call this from a c program.

wxMaxima: 67 85 80
I had to adjust my answer to fit the specs (i.e., take a value from stdin)
f():=block(n:read(),for i:2thru 100 do if(gcd(i,n)=1)then printf(true,"~d, ",i) )

Call this in the interactive session via f and then enter in your value followed by ctrl+enter to get the result.

Old, non-spec fitting answer
f(n):=for i:1thru 100 do(if(gcd(i,n)=1)then printf(true,"~d, ",i));

Enter this into the command line & execute it via f(12); to get
1,5,7,11,13,17,19,23,25,29,31,35,37,41,43,47,49,53,55,59,61,65,67,71,73,77,79,83,85,89,91,95,97,

Python 3 - 79 chars
x=int(input())
for i in range(2,101):print(i) if pow(x,i-1,i)==1or i==x+1else 0

Uses the Fermat primality test to check co-primes.

Welcome to Code Golf, and nice first answer! Also note that you are allowed to submit a function instead of a full programme.

APL(NARS), 35 chars
5↓∊(⊂', '){⍺⍵}¨' ',⍕¨a⊂⍨1=⎕∨a←1+⍳99

use as:
  5↓∊(⊂', '){⍺⍵}¨' ',⍕¨a⊂⍨1=⎕∨a←1+⍳99
⎕:
  2310
┌78─────────────────────────────────────────────────────────────────────────────┐
│ 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97│
└───────────────────────────────────────────────────────────────────────────────┘

Tcl, 218 bytes
Golfed version. Attempt This Online!
proc gcd {a b} {while {$b} {set t $b; set b [expr {$a % $b}]; set a $t}; return $a}
set n [expr {[gets stdin]}]
set r [list]
for {set k 2} {$k <= 100} {incr k} {if {[gcd $n $k] == 1} {lappend r $k}}
puts [join $r ", "]

Ungolfed version. Attempt This Online!
proc main {} {
    # Read a number from input
    set n [gets stdin]

    # Initialize an empty list to store the numbers
    set numbers {}

    # Loop through numbers 2 to 100 and check if gcd with n is less than 2
    for {set k 2} {$k <= 100} {incr k} {
        # Check if the gcd of k and n is 1 (coprime)
        if {[gcd $k $n] < 2} {
            # If so, append k to the list of numbers
            lappend numbers $k
        }
    }

    # Join the numbers with a comma and a space, and then print
    puts [join $numbers ", "]
}

proc gcd {a b} {
    # Calculate the greatest common divisor of a and b
    while {$b != 0} {
        set temp $b
        set b [expr {$a % $b}]
        set a $temp
    }
    return $a
}

# Call the main procedure
main

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Generate keyboard shortcuts for a menu
Menu Shortcuts
Traditionally, user menus are accessible by keyboard shortcuts, such as Alt + (a letter), or even simply hitting the letter when all textboxes are unfocused (gmail style).
Your task
Given the menu entries as an input, your task is to grant each menu entry a proper shortcut letter.
Write a function or a program that accepts a set of words - the menu entries (as an array of strings, or your language equivalent), and returns a dictionary, or a hashmap, from a single letter to a menu entry.
You can either use a parameter and return a value, or use the STDIN and output your results to STDOUT. You are not allowed to assume a global/scope variable is already populated with the input.
Algorithm to determine the proper letter

Basically it's the first available letter of the word. See assumptions and examples below.
In case all entry's letters are not available, the shortcut will be (a letter) + (a number). Which letter you pick from the entry is arbitrary. The number should start from 0 and be incremented by 1 - such that all shortcuts are unique. See third example below.

Assumptions

The input will be a Set, i.e. no repetitions, every entry is unique.
Length of the input can be any non-negative integer (up to MAX_INT of your language).
Case sensitivity: Input is case-sensitive, (but will stay unique when ignoring case). The results should contain the original entries with their original casing. However, the output shortcut letters are not case-sensitive.
All input words will not end with numbers.
No "evil input" will be tested. "Evil input" is such that you have to increment the counter of a certain letter more than 10 times.

Examples
Examples below are in JSON, but you can use your language equivalent for an array and a Dictionary, or - in case you're using STD I/O - any readable format for your input and output (such as csv, or even space-separated values).
1.
Input:  ['File', 'Edit', 'View', 'Help']
Output: {f:'File', e:'Edit', v:'View', h:'Help'}

2.
Input:  ['Foo', 'Bar', 'FooBar', 'FooBars']
Output: {f:'Foo', b:'Bar', o:'FooBar', a:'FooBars'}

3.
Input:  ['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba']
Output: {a:'a', b:'b', a0:'aa', b0:'bb', q:'bbq', b1:'bbb', b2:'ba'}

Winning conditions
Shortest code wins. Only ASCII is allowed.

"a" is already taken by the first entry. So for "aa" since both of its letters are already taken up, it gets a0. Same with b0-b2.

What happens when you run out of numbers?

@nderscore Is that really necessary?

Should ['ab', 'a'] give {a:'ab', a0:'a'} or {b:'ab', a:'a'}?

@Adám both are acceptable. It would be easier to implement the former since you scan the input array in an ordered manner, but if for some reason you prefer the latter - go for it.

Javascript (ES6) 106 105 100
This function takes input as an an array and outputs a javascript object.
f=i=>i.map(a=>{for(b of c=a.toLowerCase(d=0)+d+123456789)d<!o[e=b>=0?c[0]+b:b]&&(o[d=e]=a)},o={})&&o

Results:
f(['File', 'Edit', 'View', 'Help']);
// {"f":"File","e":"Edit","v":"View","h":"Help"}

f(['Foo', 'Bar', 'FooBar', 'FooBars']);
// {"f":"Foo","b":"Bar","o":"FooBar","a":"FooBars"}

f(['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba']);
// {"a":"a","b":"b","a0":"aa","b0":"bb","q":"bbq","b1":"bbb","b2":"ba"}

Ungolfed / Commented:
f=i=>{
  o={};                                        // initialize an object for output
  i.map(a=>                                    // loop through all values in input
    for(b of c=a.toLowerCase(d=0)+d+123456789) // loop through all characters of the string with 0123456789 appended to the end
                                               // and initialize d as 0 to be used as a flag
      e=b>=0?c[0]+b:b                          // if b is a number, set e to the first character + the number, otherwise b
      if(d<!o[e])                              // if the flag hasn't been triggered and o doesn't have a property e
        o[d=e]=a                               // then store the value at e and trigger the d flag
  )
  return o                                     // return the output object
}

This is beautiful. It may fail for the evil input ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa', 'aaaaaaaaaaa', 'aaaaaaaaaaaa'], but I think we can ignore such edge cases, can't we?

@Jacob And what happens when we hit 11? You can't press the one key twice in a keyboard shortcut :P

You have a point there (though it might be possible, given an implementation that waits until end of keystrokes (200ms or so)). Anyhow, I will add to assumptions no such evil input will be tested.

Python 2.x - 176 170 157 114 bytes
Very simple approach, but someone has to kick the game going.
r={}
for i in input():a=list(i.upper());r[([c for c in a+[a[0]+`x`for x in range(10)]if c not in r])[0]]=i
print r

Edit 1: Reversed the checking operation and made it set the result only once.
Edit 2: Removed branching.
Edit 3: Removed unnecessary dictionary. (thanks to the added assumption)

Examples:
Input:  ['File', 'Edit', 'View', 'Help']
Output: {'H': 'Help', 'V': 'View', 'E': 'Edit', 'F': 'File'}

Input:  ['Foo', 'Bar', 'FooBar', 'FooBars']
Output: {'A': 'FooBars', 'B': 'Bar', 'O': 'FooBar', 'F': 'Foo'}

Input:  ['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba']
Output: {'A': 'a', 'B': 'b', 'Q': 'bbq', 'A0': 'aa', 'B0': 'bb', 'B1': 'bbb', 'B2': 'ba'}

I think the only required explanation is the ungolfed code. (This actually is the original version)
items = input() # ['File', 'Edit', 'View', 'Help']
chars = map(chr,range(65,91))
numbers = {}.fromkeys(chars,0)
result = {}
for item in items:
    try:
        key = [c for c in item.upper() if c in chars][0] # causes an exception when no items match
        result[key] = item
        chars.remove(key)
    except:
        key = item[0].upper()
        result[key+`numbers[key]`] = item
        numbers[key] += 1
print result

I have to say humble thank you to @Jacob. The input format is just great.

JavaScript (ECMAScript 6) - 107 Characters
f=a=>(o={},p={},[o[[c for(c of l=w.toLowerCase())if(!o[c])][0]||(k=l[0])+(p[k]=p[k]+1|0)]=w for(w of a)],o)

Explanation:
f=a=>(
  o={},                              // The dictionary to output
  p={},                              // Stores record of numbers appended after duplicate
                                     // menu keys
  [                                  // Use array comprehension for each word w of input a
   (unmatchedCharacters
     =[c                             // Use array comprehension for each character c of
      for(c of l=w.toLowerCase())    //   the lower case of word w but only get
      if(!o[c])                      //   those characters which are not already a key in o.
     ],
    key=unmatchedCharacters[0]       // Take the first of those characters
     ||                              // Or if all characters are already in o
     (k=l[0])                        // Take the first character of the lower-case word
     +(p[k]=p[k]+1|0),               //   concatenated with the increment of the digit stored
                                     //   in p (or zero).
   o[key]=w)                         // Set o to map from this key to the word
   for(w of a)
  ],
  o)                                 // return o

Tests:
f(['File', 'Edit', 'View', 'Help']);
{f: "File", e: "Edit", v: "View", h: "Help"}

f(['Foo', 'Bar', 'FooBar', 'FooBars']);
{f: "Foo", b: "Bar", o: "FooBar", a: "FooBars"}

f(['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba']);
{a: "a", b: "b", a0: "aa", b0: "bb", q: "bbq", b1: "bbb", b2: "ba"}

PHP >= 5.4 - 149 characters
According to PHP's standards (insert sniggers here), the input isn't valid JSON as it uses ' instead of ", so I've been a bit cheeky and I'm using the Input as an actual variable declaration:
<?
$i = ['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba'];
$c=[];foreach($i as$w){foreach(str_split($w) as$j)if(!$c[$j]){$x=$j;goto f;}$n=0;do{$x=$w[0].$n++;}while($c[$x]);f:$c[$x]=$w;}echo json_encode($c);

Using the examples:
Input:  ['File', 'Edit', 'View', 'Help']
Output: {"F":"File","E":"Edit","V":"View","H":"Help"}

Input:  ['Foo', 'Bar', 'FooBar', 'FooBars']
Output: {"F":"Foo","B":"Bar","o":"FooBar","a":"FooBars"}

Input:  ['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba']
Output: {"a":"a","b":"b","a0":"aa","b0":"bb","q":"bbq","b1":"bbb","b2":"ba"}

Un-golfified it's pretty basic:
<?
$i = ['a', 'b', 'aa', 'bb', 'bbq', 'bbb', 'ba'];
$c = [];
foreach($i as $w)
{
    foreach(str_split($w) as $j)
        if(!$c[$j])
        {
            $x = $j;
            goto f;
        }
    $n = 0;
    do
    {
        $x = $w[0] . $n++;
    }
    while($c[$x]);
    f: $c[$x] = $w;
}
echo json_encode($c);

PHP has jump declarations? That's so... 90's.

You don't have to stick to JSON, I only provided the examples in JSON, but, as stated in the question, you may choose any readable format for output or use your language equivalent for a Dictionary. (You can save 13 characters by removing the json_encode invocation).

echo doesn´t work with arrays; but print_r($c); would do it, saving 9 bytes.

But this isn´t case insensitive. str_split(strtoupper($w)) and ucfirst($w[0]) can solve that (+21); or $s=strtoupper($w); (+18)

PowerShell, 91 83 bytes
$r=@{}
$args|%{$r[($_|% *wer|% t*y|%{$c=$_;,''+0..9|%{$c+$_}|?{!$r.$_}})[0]]=$_}
$r

Try it online!
It throws an exception if a proper shortcut not found.
Unrolled:
$result=@{}
$args|%{
    $shortcuts = $_|% toLower|% toCharArray|%{
        $c=$_
        ,''+0..9|%{$c+$_}|?{!$result.$_}    # output shortcuts are not exist in the result
    }
    $properShortcut = $shortcuts[0]         # throws an exception if a proper shortcut not found
    $result[$properShortcut]=$_
}
$result

PHP, 153 bytes
for($c=[];$w=trim(fgets(STDIN));$c[reset(array_diff(str_split($s),array_keys($c)))?:$y]=$w){$s=strtoupper($w);for($n=0;$c[$y=$s[0].$n++];);}print_r($c);

run with php-r '<code>' <<EOF + Enter + <word1>+Enter + <word2>+Enter + ... + EOF+Enter
working on argv for 155 bytes:
$c=[];foreach($argv as$i=>$w)if($i){$s=strtoupper($w);for($n=0;$c[$y=$s[0].$n++];);$c[reset(array_diff(str_split($s),array_keys($c)))?:$y]=$w;}print_r($c);

run with php -r '<code>' <word1> <word2> ...
(-13 bytes with a defined global: foreach($i as$w) instead of foreach($argv as$i=>$w)if($i))


text:
print "Hello, world!" without using literals
Write a program that prints "Hello, world!" without using any kinds of literals.
Don't use string literals, numeric literals, byte literals, char literals, etc. Default values are allowed in languages that have them.
Printing data from external files/websites/arguments is not encouraged.
edit: probably don't use Boolean literals either.
double edit: I don't necessarily want the code to be obfuscated. results that are clearly understandable are better.
triple edit: this is not duplicate because the other questions require obfuscated answers or are code-golf.

This is a very much duplicated question. A search for hello world will reveal how many times things like that have been tried.

hmm? searching for "hello world literals" doesn't result in anything too similar. Am I missing something?

Is the punctuation necessary? Or can it just say "Hello world"?

Why is this a popularity contest? It seems to work perfectly fine as code golf.

Very duplicated indeed. The recently active question about obfuscated "Hello world", for example, has quite a few answers that didn't use literals.

@Pyromuffin a lot of answers in here could be copied verbatim to this question, which is a good indication for this being a duplicate. Same goes for this question.

I think you need the ! at least! I can think of a few ways to do this without the ! using reflection, but not many ways with the punctuation.

I suppose that I don't necessarily want it to be obfuscated. I will edit this to make it more clear.

for instance alert(atob((function SGVsbG8sIHdvcmxk(){}).name)) copied from http://codegolf.stackexchange.com/a/22559/21348

Dang, hope this gets edited and reopened so I can post my answer.

The duplicate is code-golf. My COBOL solution wouldn't be much use there :-)

This is definitely not a duplicate of the linked question. Of my Julia solution, the Cobra solution, and the JavaScript solution by user23057, none is "obfuscated" - they may need a few tricks to get the whole expression, but anybody looking at them could guess pretty quickly that they would output "Hello, world!". None of them attempts to be particularly short, nor do they avoid certain letters or numbers as per the requirements of linked challenge.

Furthermore, the JSfuck solution is very long. As such, the only answer that is even remotely code-golfish is the HQ9+ solution, which is of course just demonstrating one of the very few capabilities of the language.

Reopen this question please.

Voted to reopen.

JSfuck
Try it in any javascript console.
Edit To avoid the array literal. Shorter too.
a=Array();
a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[+a]+(!!a+
a)[!+a+!+a+!+a]+(!!a+a)[+!+a]][(a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!
+a]+(!!a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!!a+a)[+!+a]]+a)[!+a+!+a+!+a]+(!!a+a[(!a+a
)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!
!a+a)[+!+a]])[+!+a+[+a]]+(a[a]+a)[+!+a]+(!a+a)[!+a+!+a+!+a]+(!!a+a)[+a]+(!!a+a)[
+!+a]+(a[a]+a)[+a]+(a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[
+a]+(!!a+a)[!+a+!+a+!+a]+(!!a+a)[+!+a]]+a)[!+a+!+a+!+a]+(!!a+a)[+a]+(!!a+a[(!a+a
)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!
!a+a)[+!+a]])[+!+a+[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for fun. I don't see a construction containing a variable as a 'literal'. Anyway I followed your avdice and copied an old answer, see my comment above

HQ9+ - 1 char
H

:)
Has this being a code golf, I won hands down. Is this good enough? But, well. This is good enough for popularity contest.

try again but with something that isn't HQ9+

I wouldn't count this "language" with an objective argument that it's not turing complete. In fact, it can't compute anything at all.

But it has H as "default value" right? So it's pretty much legal. I suppose.

Yes. Of course it's an interesting esoteric construct and welcome unless explicitly prohibited by the original poster. It's just not a proper language because it doesn't do what programming languages do. It's as much a language as any purpose-built program you can compile :)

HQ9+ is no longer funny

Ah. Never saw that article. Thanks.

Cobra
struct Hello
    var i
struct B
    var i
struct X
    var i
struct M
    var i
struct World
    var i
class Program
    def main
        hello = Hello().toString
        comma = Convert.toString(Convert.toChar(((Convert.toChar(X().toString) to int)-(Convert.toChar(B().toString) to int))+(Convert.toChar(X().toString) to int)-(Convert.toChar(B().toString) to int)))
        world = World().toString.toLower
        exclaim = Convert.toString(Convert.toChar(((Convert.toChar(X().toString) to int)-(Convert.toChar(B().toString) to int))+(Convert.toChar(X().toString) to int)-(Convert.toChar(M().toString) to int)))
        print hello+comma, world+exclaim

This uses the default .toString method, and some character code arithmetic.

nice job. this is the first non trivial and non obfuscated result.

Julia
Hello(x)=x
world(y)=y
k=int(ones())[]
show(Hello)
print(collect(summary([]))[end-k-k])
print(char((k+k)^(k+k+k+k+k)))
show(world)
print(!)

What it's doing: printing function names, rather than literals. Also, using int(ones())[] to get a 1, which is necessary to get the space without too much hassle (space is character 32, which is being obtained as 2^5), and using summary([]) and then getting the third-last character in order to get the comma.

Python 3.4(.0)
If you look in the right places, you can find the string "Hello, world!" somewhere.
Note: None
 is a keyword and not a literal in Python, according to the documentation.
from test import test_wsgiref

for binstring in test_wsgiref.hello_app(None, lambda x, y: None):
    print(binstring.decode())

JavaScript
i did not use any custom literals if it counts. (implying Function.name doesn't exist)
function Hello(){}
function World(){}

var hello_str = uneval(Hello),
    world_str = uneval(World),
    _1 = (+new Date())/(+new Date()),
    _2 = _1+_1,
    _4 = _2*_2,
    _8 = _2*_4;

alert([
     hello_str.substr(_8, _8 - _2),
     world_str.substr(_8, _8 - _2)
        + String.fromCharCode(_8 * _4 + _1)
]);

try: http://jsfiddle.net/pykP8/

I'm getting really nitpicky now, but is function Hello(){} a function literal? ;)

indeed it is! but can you do anything without summoning a javascript object? if i'm not mistaken, everything is a property of window (more or less).

you can use built-in functions instead of defining your own