Re: Placing the "&"
- To: mathgroup at smc.vnet.net
- Subject: [mg114795] Re: Placing the "&"
- From: Themis Matsoukas <tmatsoukas at me.com>
- Date: Fri, 17 Dec 2010 03:29:44 -0500 (EST)
Your code defines three functions, let's call them f1, f2 and f3. In all cases, & marks the end of the definition: f1 = 2^(#) + 1 & Select[Range[1000], f2 = PrimeQ[2^(#) + 1] &] Select[Range[500], f3 = PrimeQ[FromDigits[Table[1, {#}]]] &] 2^#1 + 1 & {1, 2, 4, 8, 16} {2, 19, 23, 317} As an example, let's evaluate these functions at x=1, 2, and 3: {f1[1], f1[2], f1[3]} {f2[1], f2[2], f2[3]} {f3[1], f3[2], f3[3]} {3, 5, 9} {True, True, False} {False, True, False} Themis