in reply to Infinite JAPHs?

If you require that a JAPH must be no more than 4 lines of no more than 80 characters each, then there are, at most, 128 (different ASCII characters) ** 320 different ways to write 320 characters (That's equivalent to 2 ** 2240). Since not all JAPHs are exactly 320, the actual maximum limit is the sum of 128 to the N where N varies from 1 to 320. Or, 127 * SUM( 128**N, N:0->319 ) (or SUM(2**(7N+1),N:0-319) - 1). Of course, you can start chipping away at that pretty quickly. I think the shortest JAPH is something like 50 characters, so that becomes your lowest exponent instead of 1. Not all the ASCII characters are usable, and a lot of them are interchangeable in many cases ($x vs. $y, etc), so that drops the 128 quite a bit. Factor in some more fancy math and I suspect the number drops to something like 2 ** 200 (or so). Or, roughly, 10 ** 66-ish.

In other words, if every possible JAPH were written, one per second, from now onwards, you'd run out of hydrogen in the Sun long before running out of JAPHs. Or, put it another way, if you were to write one JAPH per second from the Big Bang onwards, you'd run out of Universe before you run out of JAPHs.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.


Comment on Re: Infinite JAPHs?
Re^2: Infinite JAPHs?
by NateTut (Deacon) on Mar 30, 2005 at 19:23 UTC
    >Or, put it another way, if you were to write one JAPH per
    >second from the Big Bang onwards, you'd run out of
    >Universe before you run out of JAPHs.

    There is a certain comfort in that...
Re^2: Infinite JAPHs?
by idsfa (Vicar) on Mar 30, 2005 at 21:47 UTC

    JAPH Golf: 32

    print "Just Another Perl Hacker"

    Admittedly, not very obfuscated ...


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. -- Cyrus H. Gordon

      31!

      die"Just Another Perl Hacker\n"

      Ok, in fact thats the same length (minus the space), but it has more 'features' (ends with a newline) :-)

      -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

        Get one less character with all of the same features!

        die"Just another Perl hacker "
        Just embed an actual newline into the string :) And actually, I think the usual rules don't count physical newlines, so you might see it as saving two characters.

      That's not a JAPH... the "A" and the "H" should be lowercased, and there's a comma or a newline (you get to choose which) missing from the end...

      Anyway, you could have ommited the space after the print... :-)

        Good, I'm glad someone pointed that out. The canonical JAPH (as used by JAPH #0, namely me) produces precisely the string:
        "Just another Perl hacker,"
        The comma comes from the fact that it was a sign-off at the end of my Usenet postings:
        blah blah blah

        blah blah

        print "Just another Perl hacker,"

        (my normal dot-sig here)

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

Re^2: Infinite JAPHs?
by Anonymous Monk on Mar 31, 2005 at 10:07 UTC
    Well, you forget the condition that the program should be compilable, and, when run, should print "Just another Perl Hacker", (with or without a trailing newline/comma, and with some variation in capitalization). That will drop the number. However, since you can have:
    print"Just another Perl Hacker"
    (31 characters), you have 4 * 79 - 31 == 285 characters you can use inside comments. If we restrict them to printable characters, that leaves you with 191 characters from the ISO-LATIN-1 character set to use. That will give you:
    12431103020403707107438586374215251314062231402740033846271848553839\
    64794897942768614366472495245162250622773403971143769094322237777997\
    22224034424993652821949360607589486799938766556351642250055325548582\
    31176161943484446303420510949249800299598113919038030677551444922891\
    92170940375333669061892360087978683497677025806119812237326648034654\
    87178777460593657834903959884176099504825209804921507278509975772023\
    74764012796271389737610771093408198946475108846474664241214900907612\
    62862081852957499464585817808664830865775651649173215474773373760082\
    25416891017755307073167219366790883957292361415401836384029334901914\
    070048752861187584482256205393168201151
    
    different JAPHs of exactly 4 x 80. Which is about 10**650.
Re^2: Infinite JAPHs?
by inman (Curate) on Mar 31, 2005 at 11:03 UTC
    By defining the limits of the problem in terms of the physical size of the JAPH you have immediately demonstrated that there is a finite number of solutions even if the number is large.

    Removing the size limitation will allow you to write an infinite number of JAPHs because you only need to add more code. You could for example write:

    print "Just another Perl hacker,"; print "Just another Perl hacker,";; print "Just another Perl hacker,";;; # add more semi-colons as necessary
      . . . you have immediately demonstrated that there is a finite number of solutions even if the number is large.

      Yes, it is a "finite" number, but it is a number that is effectively infinite. For example, 10**10**10**10**10**10**10**10**10**10 is a finite number. Yet, by the 4th 10, you're already past the number of seconds the Universe will survive multiplied by the number of stars in the sky. By the 6th 10, you're past the number of possible living things that will ever live in the Universe, from Big Bang to when it dies, assuming that every 10th star has planets and every 10th such system has a planet that supports life.

      You see where I'm going . . .

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

        This is true, but only under the assumption that only one JAPH can be composed per second. If we compose one per microsecond, then a far greater number of JAPHs is achievable.

        One could, for example, write a program in - say - Perl, to generate a script with a random set of characters, execute, and check if the output matched "Just another Perl hacker[,\n]". It would then simply be a matter of adding processing power to increase your output (and assuming Moore's law still applies until the end of time, this would occur exponentially).
        Back when I studied chemistry I was introduced to Avogadros number which is numerically around 6.022x10**23 and represents the number of particles in a mole of a substance. (Google around for various explanations etc.). As it turns out, a mole of a substance weighs the same as it's atomic weight in grammes. A mole of water for example weighs 18 grammes which has a volume of 18 ml. Now start to think about the number of atoms of water in the world's oceans...

        The point of this long winded rambling is that once you get into the area of counting molecules you need to use some really big numbers. (and that's without going sub-atomic). These numbers are big but they are still finite.

        Infinity is not a number but the concept of a quantity that has no limits. In limiting the form of the JAPH in terms of the total number of characters that it can contain, you have defined limits. In order to say that there are an infinite number of JAPHs you need to expand at least one parameter so that it can always be increased. You could for example represent the JAPH using any number of character sets where each character could be expressed by an arbitrary number of bytes...

        I could go on and on and on (ad infinitum)

        This thread just got me reading again Arthur C. Clarke's famous sci-fi novel, The Nine Billion Names of God. In the story the task is similar: generate all the possible names of God using some braindead alphabet. Guess what happens when all the names are found...

        rg0now