Paul is one of your Belgian acquaintances, and he would like you to create a program that outputs at least one of the following five strings:






It represents the friends he's most proud of, and he would like to eat with them. Paul also thinks that the number 6 is perfect, and that is the only number worth using. So you cannot use any other digit than "6" in your code (0 to 5 and 7 to 9 are forbidden). Your program cannot take any inputs. The output can contain garbage before and/or after the string but should contain at least one of the above strings.

For example this is a valid output :

f**14288=>15472=>14536=>14264=>12496**fczfe fz**15472=>14536=>14264=>12496=>14288**zfe

I "ligthly" hinted in the question as how I expect this to be resolved, but how knows ? Maybe there is a better way... Hope you have fun.

This is code-golf : lowest score in bytes wins.

  • 3
    \$\begingroup\$ Related OEIS sequence. \$\endgroup\$ – Emigna Jan 13 '17 at 14:27
  • 5
    \$\begingroup\$ I can't figure out what Paul or chickens have to do with this. \$\endgroup\$ – Magic Octopus Urn Jan 13 '17 at 15:09
  • 6
    \$\begingroup\$ @carusocomputing : The sociable chain '12496=>14288=>15472=>14536=>14264" was found by Paul Poulet, in 1918 (a belgian mathematician). And "poulet" means "chicken" in french. Also 6 is a perfect number in the sense that the sum of its divisor is 6. \$\endgroup\$ – Jylo Jan 13 '17 at 15:43
  • 8
    \$\begingroup\$ Wait, so a manchicken found a sequence of numbers in 1918... and we care more about the number sequence than the mathematical manchicken named Paul? \$\endgroup\$ – Magic Octopus Urn Jan 13 '17 at 15:55
  • 1
    \$\begingroup\$ @Dennis, well this is true, I was'nt expecting a bruteforce 4 byte answer, you're always a surprise :p I added this rule because I was hoping to give an edge if someone was iterating over integers and outputing all found sociable chains without hard coding a complicated number first. But in the end it seem to favor greatly base conversion, and character conversion even in non golfy language. I think designing question is really hard ! Still, Enigma used the property of the output and has the higher score so far :) \$\endgroup\$ – Jylo Jan 14 '17 at 7:52

15 Answers 15


05AB1E, 18 17 bytes


Try it online!


•w[•                # base 214 encoding of 12496
    Y·F             # loop 2*2 times
       D            # duplicate top of stack
        Ñ           # push divisors
         ¨          # remove the last element (itself)
          O         # sum
           }        # end loop
            )       # wrap in list
             „=>ý   # join list on "=>"

In short, we calculate each number as f(n+1) = sum(divisors(f(n)) - f(n)


Pyke, 16 bytes


Try it here!

wヰ             -  12496
  w$            -   4
    V    )      -  repeat ^:
     D          -   duplicate(^)
      l         -     factors(^)
       s        -    sum(^)
        h       -   ^ + 1
          J     - v.join(^)
           "=>  -  "=>"

Anytime a string literal is at the end of a program, it swaps it with the token just before it, saving 1 byte in cases such as this. Pyke's factors function doesn't include the number itself nor 1. If numbers were allowed, 1 byte could be saved by replacing w$ with 4

Pyke, 21 bytes


Try it here!

Create a list of the numbers required and joins them. Not very interesting apart from the trick with the strings.


MATLAB, 44 bytes


Try it online!

I haven't found a pattern in the numbers (and it would be hard to use the pattern to anything anyways, since I can't use numbers), so I'll just go for the naive approach.

'=>@EBIJ=@>DDIJ=A@C>IJ=@A?BIJ=@>B@' is the string '12496=>14288=>15472=>14536=>14264' when 12 is added to the ASCII-values. Now, input that string, subtract 6+6, and concatenate with the empty string '' to convert it to a character array.

  • \$\begingroup\$ Yeah, sorry, I wanted to prevent the hard coding of number, but it's sure giving an edge to 'golfy' language. There is no pattern although each number is the sum of the divisor of the previous one. \$\endgroup\$ – Jylo Jan 13 '17 at 15:53
  • 1
    \$\begingroup\$ I like the way the coded string still contains =>. \$\endgroup\$ – Neil Jan 13 '17 at 21:43

JavaScript (ES6), 57 bytes/47 (UTF-8) characters

Thanks to user5090812 for 10 B save



First we create an array and fill it with the characters in the string バ㟐㱰㣈㞸. Then we loop over the string (a has the value of the current element) and we change the character into its character code. Then we join all values in the array by =>.

Old: 67 bytes



First we create an array of length 5. Then we change the values of the array at each index for the character code of the character at that same index in the string バ㟐㱰㣈㞸, which are the numbers of all of Paul's friends in order. When we got that, we join the array together, and we use => as separator.


To use it, simply run this:



  • \$\begingroup\$ How about _=>[...'バ㟐㱰㣈㞸'].map(s=>s.charCodeAt()).join`=>` \$\endgroup\$ – user5090812 Jan 13 '17 at 18:31
  • \$\begingroup\$ @user5090812 Thanks for the suggestion! \$\endgroup\$ – Luke Jan 13 '17 at 18:34

Ruby, 36 bytes (26 characters)


Because, why not. Boring as hell.

older version - 53 bytes

p %w(jol mld oim n6b mke).map{|x|x.to_i ~-6*~-6}*'=>'

Explanation: encoding the numbers in base 25 gives the 5 six-free strings, to decode them I only have to represent the number 25 using only 6: (6-1)(6-1) => ~-6~-6

  • \$\begingroup\$ I count 36 bytes with UTF8, not 26. \$\endgroup\$ – smls Jan 13 '17 at 18:17
  • 1
    \$\begingroup\$ I guess he counted the characters, and not the bytes. I always use this site for byte counts. \$\endgroup\$ – Luke Jan 13 '17 at 18:45
  • \$\begingroup\$ Corrected count now. \$\endgroup\$ – G B Jan 13 '17 at 19:03

Perl 6, 63 59 bytes

{$/=6;$/--;join "=>",<JOL MLD OIM N6B MKE>».parse-base($/*$/)}

{join "=>",<JOL MLD OIM N6B MKE>».parse-base(--($_=6)*$_)}

Decodes the numbers from base 25, because that's the only base supported by .parse-base (2 to 36) where none of them have invalid digits.

Thanks to Neil for -3 bytes.

Perl 6, 82 75 bytes

{my \a="BXS".parse-base(6*6);join "=>",(a,{sum grep $_%%*,^$_}...^{$_==a if $++})}

{my \a="BXS".parse-base(6*6);join "=>",({$/=$_//a;sum grep $/%%*,^$/}...a)}

Decodes the number 15472 in base 36, and then generates the sequence by calculating each number as the sum of proper divisors of the previous number.

Perl 6, 69 bytes (47 characters) - noncompeting


Doesn't use any of the forbidden ASCII digits, uses Unicode digits from the Arabic-Indic block instead (2 bytes each)! The { } string interpolations make sure they're parsed as Perl 6 number literals, and then stringified to their ASCII representations.

Okay, this is cheating - that's why I didn't use it as my main answer... :)

  • \$\begingroup\$ Since I don't readily have access to a Perl 6 interpreter, does it work to write --$/*$/? \$\endgroup\$ – Neil Jan 15 '17 at 10:36
  • \$\begingroup\$ @Neil: It does. Thanks! In fact, it even works if I inline the assignment, like --($/=6)*$/). \$\endgroup\$ – smls Jan 15 '17 at 11:00

Jelly, 5 4 bytes


Prints all five strings. Takes advantage of the fact that "garbage" output is allowed and buries the five strings in 103003 characters of output.

How it works

ȷṗȷỌ  Main link. No arguments.

ȷ     Set the return value to 1000.
 ṗȷ   Cartesian power; form all arrays of length 1000 that consist of integers in
      [1, ..., 1000].
   Ọ  Unordinal; convert all integers to characters.
  • \$\begingroup\$ What's the byte offset of the required string within the output? \$\endgroup\$ – Neil Jan 15 '17 at 10:31
  • \$\begingroup\$ Is there any proof to support any one of the required strings is actually printed? \$\endgroup\$ – Erik the Outgolfer Jan 15 '17 at 16:54
  • 1
    \$\begingroup\$ @Neil The character offset should be 48049051056053060061048051049055055060061048052051054049060061048051052050053060061048051049053051000. Not sure about bytes. \$\endgroup\$ – Dennis Jan 15 '17 at 17:24
  • \$\begingroup\$ @EriktheOutgolfer If by actually you mean with reasonable time and memory constraints, then no. The challenge doesn't specify any limits though, and they're unlimited by default. \$\endgroup\$ – Dennis Jan 15 '17 at 17:25
  • \$\begingroup\$ @Dennis No, I mean ever. Of course it's implied it won't finish its job anytime soon. Judging by the code, though, I think that it's really unlikely to ever print any of those strings. Then, again, I just thought of some reasonable proof... \$\endgroup\$ – Erik the Outgolfer Jan 15 '17 at 17:31

C, 94 84 77 Bytes

Stoopid simple. Special thanks @Neil



  • \$\begingroup\$ At least on ideone, you can move the char*m inside the for() to save a byte, and it also makes the function reusable (necessary condition of functions). Also, you output a trailing null; *++m would fix that. Also, you can save some bytes by subtracting 60 instead of 66: g(){for(char*m="!mnpuryzmpnttyzmqpsnyzmpqoryzmpnrp";*++m;)putchar(*m-66+6);}. \$\endgroup\$ – Neil Jan 13 '17 at 21:40
  • \$\begingroup\$ Or you could copy the approach from the MATLAB answer, which would save another byte on top of that. \$\endgroup\$ – Neil Jan 13 '17 at 21:42
  • \$\begingroup\$ @Neil my compiler won't let me declare inside of the for loop initial declaration used outside C99 mode but I'm happy to simplify the putchar. Thanks! \$\endgroup\$ – cleblanc Jan 13 '17 at 22:09

PHP, 73 63 60 bytes


Run with -nr.

a little less lazy: took string as list of =>1(ascii)(ascii)
i.e.: 124,96,=>1,42,88,=>1,54,72,=>1,45,36,=>1,42,64;
print =>1 by string index, append ascii code


            # loop through string with index $i
            # string ascii values: 124,96,42,88,54,72,45,36,42,64
    !!$i        # true if $i>0
    &++$i       # odd if (old) $i is 0,2,4,6,8
                # -> true for 2,4,6,8
        ?"=>".!!6   # if true, print "=>1"
        :"",        # else print nothing
    ord($c);    # print ascii value

C++, 92 bytes

#include <cstdio>
int main(){for(char c:"UVX]ZabUXV\\abUYX[VabUXYWZabUXVZX")putchar(c-6*6);}

PHP, 53 bytes


Hex dump:

00000000: 3c3f 3d6a 6f69 6e28 273d 3e27 2c75 6e70  <?=join('=>',unp
00000010: 6163 6b28 2776 2a27 2c67 7a69 6e66 6c61  ack('v*',gzinfla
00000020: 7465 2827 bb60 70c1 bcc0 e684 c50e 7300  te('.`p.......s.
00000030: 2729 2929 3b                             ')));




Each of the five-digit integer sections is encoded as an unsigned short little endian, then concatenated together and the result is gzipped. This happens to produce a byte steam that has no offending digit characters, which is then hard-coded into a string. To extract, un-gzip the stream, unpack the two-byte shorts, interpret each as a string, and join with >=.

  • \$\begingroup\$ how about a breakdown? \$\endgroup\$ – Titus Jan 16 '17 at 13:37

Java 8, 134 bytes


()->{String s="";for(String a:new String[]{"JOL","MLD","OIM","N6B","MKE"}){if(!s.isEmpty())s+=("=>");s+=Long.valueOf(a,25);}return s;}

Ungolfed, full program:

import java.util.function.*;

public class FindFiveFriendsToEatChickenWithPaul {

  public static void main(String[] args) {
    System.out.println(toString(() -> {
      String s = "";
      for (String a : new String[] { "JOL", "MLD", "OIM", "N6B", "MKE" }) {
        if (!s.isEmpty()) s += ("=>");
        s += Long.valueOf(a, 25);
      return s;


  private static String toString(Supplier<String> s) {
    return s.get();


Batch, 191 bytes

@echo %s: ==^>%
@for /l %%i in (%u%,%u%,%n%)do @set/an-=%%i*!(%n%%%%%i)
@set s=%s% %n%

I estimate that it would take a minimum of 32 bytes to calculate each number using only 6s plus another 32 to print them all out, which is already 192 bytes, so I'm winning by computing the amicable chain. Also, I think five %s in a row is a record for me. Also, neat Batch trick: the %n% is substituted before the for loop is evaluated, so the loop calculates all the factors of n, and subtracts them from n, thus resulting in the negation of the desired result.


Jelly, 12 bytes


Prints the fourth string and nothing else.

Try it online!

How it works

“<ọ’ÆṣÐĿj“=>  Main link. No arguments.

“<ọ’          Yield the 1-based indices of '<' and 'ọ' in Jelly's code page, i.e.,
              [61, 222], and convert the array from base 250 to integer.
              This yields 15472.
      ÐĿ      Iteratively call the link to the left until the results are no longer
              unique and return the array of all unique results.
    Æṣ        Compute the proper digit sum of the previous value (initially 15472).
        j“=>  Join, separating by the string "=>".

Python 2, 78 72 bytes

print''.join(chr(ord(x)-6-6)for x in'=@>DDIJ=A@C>IJ=@A?BIJ=@>B@IJ=>@EB')

Edit - Thanks to Stewie Griffin for saving 6 bytes!

Also, another solution would be to output all the possible permutations. OP says garbage is fine.

from itertools import permutations
print str(list(permutations(''.join(str(x)+'.'for x in range(int('9'*5)).replace(',','').replace('\'','') 
# also 9 and 5 need to be converted using ord and chr

There is too much redundancy in converting from int or list to str. I guess this would be easier in some esoteric languages, but I know none of them.

  • \$\begingroup\$ Could you add 66 instead of 12? This would save another byte. \$\endgroup\$ – G B Jan 13 '17 at 15:54
  • \$\begingroup\$ It will go out of the normal ASCII-range @GB, meaning you would have to count two bytes per character. \$\endgroup\$ – Stewie Griffin Jan 13 '17 at 15:55
  • \$\begingroup\$ I see, I didn't count the '=>' characters. \$\endgroup\$ – G B Jan 13 '17 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.