Puzzles/2147483647

From J Wiki
Jump to navigation Jump to search

Problem

Provide a sentence whose result is 2147483647.

Constraints

The following constraints are listed in order. That is, sentences which satisfy constraint N equally are selected from by constraint N+1. All sentences must satisfy constraints 0, 1, and 2.

1.#0 Sentence must produce 2147483647. That is, satisfy 2147483647&-:@:".. This constraint is absolute. 1. The result must be guaranteed (predicted, fully supported) by the Dictionary. To put it another way, you may not leverage bugs in the implementation (but you may leverage bugs in the documentation). This constraint is absolute. 1. Assume you're running under $jconsole -jprofile: that is, you may not depend on any sentence having been executed before your own (but see the section "Note on display"). Put another way, do not rely on the names normally defined by the J standard library. This constraint is absolute. 1. Among sentences that satisfy the preceding constraints equally, those with the minimum number of characters composing nouns are preferred. That is, minimize +/@:(#&> * 0: = 3 : '4!:0 {.;:''u''[". ::0:''u=.'',y.'&>)@:;:. 1. Among sentences that satisfy the preceding constraints equally, those with the smallest number of words are preferred. That is, minimize #@:;:. 1. Among sentences that satisfy the preceding constraints equally, those the smallest number of total characters are preferred. That is, minimize #.

Note on display

Note that, in the default J configuration, integer 2147483647 displays in full, but floating point 2147483647 does not. If your sentence produces a floating point result, you may have to increase your print precision to see this value.

To do so, use 9!:11]16. You may assume that sentence has been run prior to your solution sentence, and that it does not count as part of your sentence.

Alternatively, you may append a single trailing x to one numeric noun in your sentence, and that character will not count as part of your sentence; it will be treated as if it were not there. That is, it does not count towards the number of characters composing the noun, nor towards the total number of characters in the sentence, nor towards any other constraint.

Guidelines

I do not wish to break the standing solutions. But in retrospect, the following would have been constraints. Consider them guidelines.

  1. Sentences should convey something meaningful or unique about 2147483647. This could never have been a constraint, as it cannot be defined rigorously. But, as examples, the number is:
    • The highest signed 32-bit IEEE integer: 2147483647 -: #. 0 , 31 # 1. 32-bit IEEE signed integers are a very common format as of this writing.
    • Prime: 1 -: # q: 2147483647
    • A Mersenne prime: 2147483647 -: <: 2 ^ p: 10.
    • An iterated Mersenne prime: 2147483647 -: <: 2 ^ <: 2 ^ p: 2 or 2147483647 -: (2&(<:@:^) p:) 2.
  2. The challenge could be tightened with "minimize repetitions of primitives; that is, minimize >./@:(#/.~)@:;:". Put another way, given an arbitrarily long string of J verbs and a single digit number, any integral value could be calculated. The simplest example is: +/(],],], ... )1 using the appropriate number of repetitions of ,]. Though such solutions would lose out to versions using fewer verbs, they still evade the spirit of the challenge. Don't submit them.
  3. Perhaps the nouns themselves should be minimized. That is, where two solutions which satisfy the other constraints equally, but one mentions only 2 where the other mentions 5, the former is preferred. But much thought would have to be given forms such as __ and 'literal', etc.
  4. Given the display issue, perhaps the datatype of the output could be considered. That is, where two solutions which satisfy the other constraints equally, but one outputs an integer and the other a float, then the former is preferred.


Cueball: 253 is 11x23 / Man at computer: What? / Cueball: I'm factoring the time.









Spoiler Alert!

























Solutions

No. Sentence Noun

chars

Words Total

chars

Notes Author/Sig
0 2<:@^^:[5 2 7 10 Solution is one character less than 2147483647 itself. -- Dan Bron <<DateTime(2006-05-15T21:02:59Z)>>
1 <:(*-:)*:*:+:8 1 9 14 -- Roger Hui <<DateTime(2006-05-16T03:47:13Z)>>
2 <:(*-:)*:*:*:*:#+`+ 0 13 19 -- Roger Hui <<DateTime(2006-05-16T03:55:00Z)>>
3 <:-:*:*:*:*:*:#+`+ 0 11 18 -- Roger Hui <<DateTime(2006-05-16T04:08:05Z)>>
4 <:-:*:*:^~*:#+`+ 0 11 16 -- Ewart Shaw <<DateTime(2006-05-16T10:03:08Z)>>
5 #.=~i.<:+:*:4:+`+ 0 11 17 -- Roger Hui <<DateTime(2006-05-16T16:14:08Z)>>
6 #.*i.+:*:4:+`+ 0 9 14 -- Ewart Shaw <<DateTime(2006-05-16T17:02:03Z)>>
7 (<:@^~#)~^:]~#`5: 0 14 17 Worse than the others. But the idea is there... -- Dan Bron <<DateTime(2006-05-16T17:04:17Z)>>
8 p:$:@>:&.p: ::]#+`+ 0 12 18 very inefficient (be prepared to use jbreak or kill your j session), and depends on p: implementation limit -- only theoretically correct even with those constraints, probably dies with a stack error -- Raul Miller <<DateTime(2006-05-16T18:55:17Z)>>
9 (<:@^^:[p:)#+`+ 0 12 15 Still not as good. -- Dan Bron <<DateTime(2006-05-16T19:54:45Z)>>
10 #.@:*@$~^:2:#{.":?`? 0 14 20 Not very good. -- B Jonas <<DateTime(2006-05-16T23:27:14Z)>>
11 #.@:*@$~^:2:5:?`? 0 12 17 A demoronized version of the previous one -- B Jonas <<DateTime(2006-05-17T08:59:07Z)>>
12 <:-:(#^#^5:)?`? 0 12 15 A saner 12er -- B Jonas <<DateTime(2006-05-17T10:20:34Z)>>
13 #.@:*@$~^:]2:`5: 0 11 16 Nice idea, Dan Bron -- B Jonas <<DateTime(2006-05-17T10:20:34Z)>>
14 ".}.}.;?`o2147483647 0 7 20 Whoopsie, sorry -- B Jonas <<DateTime(2006-05-17T13:19:59Z)>>
15 ".}.;o2147483647`j0 0 6 19 Even -- B Jonas <<DateTime(2006-05-17T13:34:05Z)>>
16 .;x7463847412`] 0 6 18 -- B Jonas <<DateTime(2006-05-17T13:47:03Z)>>
17 33 b.~_1 4 4 8 Merely interesting; drawbacks are that it has many noun-characters and is machine-architecture-dependent -- Dan Bron <<DateTime(2007-11-05T17:14:01Z)>>
18 ->:{.i:_j1 4 4 8 Same note as no. 17: solution is merely interesting; drawbacks are that it has many noun-characters and is machine-architecture-dependent -- Dan Bron <<DateTime(2008-06-05T18:31:45Z)>>

See also