[Question]
  [
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
 
 
Closed 7 years ago.
**Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
 
 
[# 4, 8, 15, 16, 23, 42](http://lostpedia.wikia.com/wiki/The_Numbers)
Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere.
The following is not a valid Java program to output The Numbers because The Numbers appear in its source code:
```
class TheNumbers {
    public static void main(String[] args) {
        for(int n = 0;;) System.out.println(
            n == 4 ? n = 8 :
            n == 8 ? n = 15 :
            n == 15 ? n = 16 :
            n == 16 ? n = 23 :
            n == 23 ? n = 42 : (n = 4)
        );
    }
}
```
The definition of *"The Numbers must not appear in your source code"* is as follows:
* You must not use the numeral 4.
* You must not use the numeral 8.
* You must not use the numeral 1 followed by the numeral 5.
* You must not use the numeral 1 followed by the numeral 6.
* You must not use the numeral 2 followed by the numeral 3.
If your language ignores certain characters that can be placed between the numerals, it's not a valid substitution. So for example if your language interprets the literal `1_5` as `15`, this would count as the numeral 1 followed by the numeral 5.
Alternative bases are included in the restriction, so for example:
* Binary 100 can't be used as a substitute for 4.
* Octal 10 can't be used as a substitute for 8.
* Hexadecimal F can't be used as a substitute for 15.
Therefore, the following is a valid (but not very inspired) Java program to output The Numbers because The Numbers do not appear in its source code:
```
class TheNumbers {
    public static void main(String[] args) {
        for(int n = '*';;) {
            System.out.println(n -= '&');
            System.out.println(n *= 2);
            System.out.println(n += 7);
            System.out.println(++n);
            System.out.println(n += 7);
            System.out.println(n += 19);
        }
    }
}
```
Note that in that program, `'*'` and `'&'` are substituted for the integers 42 and 38, because otherwise the numerals 4 and 8 would appear in its source code.
The definition of *"outputs the sequence infinitely"* is open to interpretation. So, for example, a program that outputs glyphs getting smaller until they are "infinitely" small would be valid.
Kudos if you are able to generate the sequence in some way that's not basically hard-coding each number.
* Deriving it to a formula. My impression is there is not one but maybe there is or it can be faked.
* [Fixing a pseudo-random generator](https://stackoverflow.com/questions/15182496/why-does-this-code-print-hello-world) to return the sequence.
This is a popularity contest, so be creative. The answer with the most up votes on March 26th is the winner.
  
[Answer]
# Java
I decided to add another entry since this is completely different from my first one (which was more like an example).
This program calculates the average of an array entered by the user...
```
import java.util.Scanner;
public class Numbers {
    public static double getSum(int[] nums) {
        double sum = 0;
        if(nums.length > 0) {
            for(int i = 0; i <= nums.length; i++) {
                sum += nums[i];
            }
        }
        return sum;
    }
    public static double getAverage(int[] nums) { return getSum(nums) / nums.length; }
    public static long roundAverage(int[] nums) { return Math.round(getAverage(nums)); }
    private static void beginLoop(int[] nums) {
        if(nums == null) {
            return;
        }
        long avg = roundAverage(nums);
        System.out.println("enter nums for average");
        System.out.println("example:");
        System.out.print("array is " + nums[0]);
        for(int i = 1; i <= nums.length; i++) {
            System.out.print(", " + nums[i]);
        }
        System.out.println();
        System.out.println("avg is " + avg);
    }
    private static int[] example = { 1, 2, 7, 9, };
    public static void main(String[] args) {
        boolean done = false;
        while(!done) {
            try {
                int[] nums = example;
                beginLoop(nums);
                nums = getInput();
                if(nums == null) {
                    done = true;
                } else {
                    System.out.println("avg is " + getAverage(nums));
                }
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }
    static int[] getInput() {
        Scanner in = new Scanner(System.in);
        System.out.print("enter length of array to average or 0 to exit: ");
        int length = in.nextInt();
        if(length == 0) {
            return null;
        } else {
            int[] nums = new int[length];
            for(int i = 0; i <= nums.length; i++) {
                System.out.print("enter number for index " + i + ": ");
                nums[i] = in.nextInt();
            }
            return nums;
        }
    }
}
```
...or does it?
```
java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    at Numbers.getAverage(Numbers.java:15)
    at Numbers.roundAverage(Numbers.java:16)
    at Numbers.beginLoop(Numbers.java:23)
    at Numbers.main(Numbers.java:42)
java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    at Numbers.getAverage(Numbers.java:15)
    at Numbers.roundAverage(Numbers.java:16)
    at Numbers.beginLoop(Numbers.java:23)
    at Numbers.main(Numbers.java:42)
java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    ...
```
[Answer]
## Python
```
#!/usr/bin/python
lizt = ["SPOI",
        "LERS: Lo",
        "st begins with ",
        "a plane crash on",
        "a desert island and end",
        "s with its viewers stuck in limbo forever."
        ]
while True:
    for item in lizt:
        print len(item)
```
**Edit:** As per nneonneo's suggestion, script now includes no digits.
[Answer]
# Perl
There is nothing hidden in the source code. Nope. If the code doesn't work, type `use re "eval";` before it (required in Perl 5.18).
```
''=~('('.'?'.('{').(
'`'|'%').('['^'-').(
"\`"| '!').('`'|',')
.'"'. '\\' .'@'.('`'
|'.') .'=' .'('.('^'
^('`'       |"\*")).
','.("\:"& '=').','.
('^'^('`'| ('/'))).(
'^'^("\`"| '+')).','
.('^'^('`'|('/'))).(
'^'^('`'|'(')).','.(
'^'^('`'|',')).('^'^
("\`"|     '-')).','
.('^' ^('`' |'*')).(
'^'^( "\`"| (','))).
(')').     ';'.('['^
','). ('`'| ('(')).(
"\`"| ')'). ('`'|','
).('`'     |'%').'('
.'\\'.'$'.'|'."\=".(
'^'^('`'|'/'))."\)".
'\\'.'{'.'\\'."\$".(
"\["^ '/')       .((
'=')  ).+( '^'^('`'|
'.' ) ).(( (';'))).(
"\`"| '&').     ('`'
|'/') .('['^')') .((
'(')) .''. '\\'. '@'
.+(     '`'     |'.'
).')'.'\\'.'{'.('['^
'(').('`'|',').('`'|
'%').('`'|'%').('['^
'+'). '\\'.     '$'.
'_'.  '-'. '\\'. '$'
.+( ( '[') ^'/').';'
.'\\' .'$'      .''.
('['^ '/') .'='. (((
'\\') )).+ "\$". '_'
.((     ';'     )).+
'\\'.'$'.'_'.'='.'='
.('^'^('`'|'*')).'|'
.'|'.('['^'+').('['^
')'     ).(     '`'|
(( ')')) ) .('`' |((
'.'))).( '['^'/' ).+
(((     (((     '\\'
)) )))).'"'.('{' ^((
(( '[')))) ).''. (((
((       ((     '\\'
))))))).'"'.';'.('['
^'+').('['^')').('`'
|')').('`'|'.').('['
^+ '/').''.     '\\'
.+ '}'. +( "\["^ '+'
). ('[' ^"\)").( '`'
|+       ((     ')')
)).('`' |+ '.').('['
^'/').( (( '{'))^'['
).'\\'. ((       '"'
)).('!'^'+').('\\').
'"'.'\\'.'}'.(('!')^
'+').'"'.'}'.')');$:
='.'#madebyxfix#'.'=
^'~';$~='@'|"\(";#;#
```
Explanation in spoiler.
> 
>  This is a simple Perl program which makes use of multiple bitwise operations, and evaluates the regular expression using **=~** operator. The regex begins with **(?{** and ends with **})**. In Perl, this runs code while evaluating regular expression - this lets me use **eval** without actually using it. Normally, however, **re "eval"** is required, for security reasons, when evaluating regular expressions from strings (some older programs actually took regular expressions from the user) - but it turns out that before Perl 5.18 there was a bug causing constant folded expressions to work even without this pragma - if you are using Perl 5.18, type **use re "eval";** before the code to make it work. Other than that, there is not much else to this code.
> 
> 
> 
[Answer]
## Brainfuck
I'm so bad at ASCII art !
```
++        ++++++++    +[>+>++    ++>++++
+<        <<-]>++>    >-           --<
<<        +[    >>    >.<.>++      ++.
<.        >-    --    ----.++      ++.
<.>---    -.+++++.         <.      >--
-/-./+    .<.>+.-/    -.++<<.      </]
```
Test it here : <http://ideone.com/kh3DYI>
[Answer]
## Unix C
There are lots of places to find numeric constants.
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <fcntl.h>
#include <pwd.h>
#include <netdb.h>
int main(void)
{
  int thenumbers[] = {
    S_IRGRP|S_IXGRP|S_IWOTH,
    ntohs(getservbyname("telnet", "tcp")->s_port),
    exp(M_E)-cos(M_PI),
    SIGTERM,
    CHAR_BIT,
    strlen(getpwuid(EXIT_SUCCESS)->pw_name)
  }, i=sizeof(thenumbers)/sizeof(*thenumbers);
  while(i--)
    printf("%d\n", thenumbers[i]);
  return main();
}
```
[Answer]
## C#
> 
>  Formula "stolen" from <https://oeis.org/A130826> :
>  a(n) is the smallest number such that twice the number of divisors of (a(n)-n)/3 gives the n-th term in the first differences of the sequence produced by the Flavius-Josephus sieve.
> 
> 
> 
```
using System;
using System.Collections.Generic;
using System.Linq;
public static class LostNumberCalculator
{
    public static int GetNumber(int i)
    {
        int a = GetPairwiseDifferences(GetFlaviusJosephusSieveUpTo(100)).ElementAt(i);
        int b = FindSmallestNumberWithNDivisors(a / 2);
        return b * 3 + i + 1;
    }
    public static IEnumerable<int> GetFlaviusJosephusSieveUpTo(int max)
    {
        List<int> numbers = Enumerable.Range(1, max).ToList();
        for (int d = 2; d < max; d++)
        {
            List<int> newNumbers = new List<int>();
            for (int i = 0; i < numbers.Count; i++)
            {
                bool deleteNumber = (i + 1) % d == 0;
                if (!deleteNumber)
                {
                    newNumbers.Add(numbers[i]);
                }
            }
            numbers = newNumbers;
        }
        return numbers;
    }
    public static IEnumerable<int> GetPairwiseDifferences(IEnumerable<int> numbers)
    {
        var list = numbers.ToList();
        for (int i = 0; i < list.Count - 1; i++)
        {
            yield return list[i + 1] - list[i];
        }
    }
    public static int FindSmallestNumberWithNDivisors(int n)
    {
        for (int i = 1; i <= int.MaxValue; i++)
        {
            if (CountDivisors(i) == n)
            {
                return i;
            }
        }
        throw new ArgumentException("n is too large");
    }
    public static int CountDivisors(int number)
    {
        int divisors = 0;
        for (int i = 1; i <= number; i++)
        {
            if (number % i == 0)
            {
                divisors++;
            }
        }
        return divisors;
    }
}
class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            for (int i = 0; i < 6; i++)
            {
                int n = LostNumberCalculator.GetNumber(i);
                Console.WriteLine(n);
            }
        }
    }
}
```
[Answer]
# C#
Using the fact that any sequence of N elements can be generated by an N-1 polynomial and entering the numbers involved a lot of beeps and boops. For reference, the polynomial I derived is
```
( -9(X^5) +125(X^4) -585(X^3) +1075(X^2) -446(X) +160 ) / 40
```
I assigned the factors to the variables named for the numbers, for simplicity ;)
First version:
```
int BEEP,
// Magic numbers, do not touch.
four = -9,
eight = 125,
fifteen = -117*5, 
sixteen = 1075,
twenty_three = (-1-1337) /3,
forty_two = 320/2;
for(BEEP=0;;BEEP=++BEEP%6)
{
    Console.WriteLine( 0.025* (
        four *BEEP*BEEP*BEEP*BEEP*BEEP+ 
        eight *BEEP*BEEP*BEEP*BEEP+ 
        fifteen *BEEP*BEEP*BEEP+
        sixteen *BEEP*BEEP+
        twenty_three *BEEP+ 
        forty_two ));
}
```
I liked the implication of rising tension as the number of BEEPs decreases after each number.
Then I figured I could calculate the factors using beep and boops, too:
```
int BEEEP=0, BEEP=++BEEEP ,BOOP=++BEEP,BLEEP=++BOOP+BEEP,
four = BOOP*-BOOP,
eight = BLEEP*BLEEP*BLEEP,
fifteen = BOOP*-(BOOP+(BEEP*BLEEP))*BLEEP*BOOP,
sixteen = BLEEP*BLEEP*(BOOP+(BLEEP*BEEP*BEEP*BEEP)),
twenty_three = BEEP*-((BLEEP*BOOP*BLEEP*BOOP)-BEEP),
forty_two = BEEP*BEEP*BEEP*BEEP*BEEP*BLEEP;
```
Went a little overboard after that...
```
int BEEEP=default(int), BEEP=++BEEEP ,BOOP=++BEEP,BLEEP=++BOOP+BEEP;
for(--BEEEP;;BEEEP=++BEEEP%(BEEP*BOOP))
{
    Console.WriteLine(
    BOOP*(                       (BOOP*-BOOP)*BEEEP    *BEEEP*BEEEP*BEEEP    *BEEEP+(BLEEP*BLEEP*
    BLEEP)                       *BEEEP*      BEEEP*    BEEEP*                     BEEEP+
    (BOOP*                       -(BOOP+      (BEEP*    BLEEP)                    )*BLEEP
    *BOOP)                       *BEEEP*      BEEEP*    BEEEP+(BLEEP*BLEEP        *(BOOP+
    (BLEEP*                       BEEP*        BEEP*                 BEEP)))       *BEEEP*
    BEEEP+                       (BEEP*-(     (BLEEP                 *BOOP*         BLEEP
    *BOOP)                       -BEEP))      *BEEEP+                (BEEP*         BEEP*
    BEEP*BEEP*BEEP*BLEEP))/     (BEEP*((BEEP*BEEP*BEEP  *BEEP*BEEP*BEEP)-(        BEEP+BEEP))));
}
```
Using the default operator in C# for value types allows initialization of BEEEP to zero. This way no numeric literals are used in the code. The basic algorithm is the same. but the factors are calculated inline. 
[Answer]
## D
Not allowed to use the numbers 4, 8, 15, 16, 23, or 42 in my code? No problem, then I won't use numbers at all!
```
import std.stdio;
void main()
{
    while( true )
    {
        ( ',' - '('  ).writeln;
        ( '/' - '\'' ).writeln;
        ( '/' - ' '  ).writeln;
        ( '_' - 'O'  ).writeln;
        ( '^' - 'G'  ).writeln;
        ( '~' - 'T'  ).writeln;
    }
}
```
[Answer]
# Javascript + HTML
Anti-golf!
```
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<pre>
/*hereIsTheDataPart~                    Es="5030000307000022
E2000000100000010000                    E5370000507000022200
E0010100001110000005                    E0337001010000102220
E0100010010111005033                    E7001010000102220010
E1010010111~33079900                    E1000111102221000001
E1110111~03037910100                    E0111102220010100001
E0111".replace(/~/g,                    E5);Zfillfillfillfil
Eqw=21;fq=2;fz=fq*2;                    Efl=fz*2;fm=fl*2;fw=
Efm+2; M=Math;functi                    Eon r(n,i,z){return 
Efunction(){l=i||'';                    E;for(m=0;m!=n;m++)l
E+=String.fromCharCo                    Ede(97+M.floor(M.ran
Edom()*26));return l                    E+(z||'')}};kb=r(fm,
E'/*','*'+'/');kc=r(                    Efw,'//');kd=r(20);Z
Eke=r(fw,'/*');kf=r(                    E20);kg=r(fw,'','*'+
E'/');kh=kf;ki=new Z                    EArray(21).join(' ')
E;x=[];for(n=35*ix;n                    E!=s.length;++n){x.Z
Epush(parseInt(s[n])                    E)};oo=function(){oZ
E+=z==1?kb():z==9?kc                    E():z==3?(ee.shift()
E||kd()):z==5?(y==0?                    Eke():(ee.shift()||Z
Ekf())):z==7?(y==(yl                    E-1)?kg():(ee.shift(
E)||kh())):z==0?ki:Z                    Epl.shift();}Ze=mc^2
EZthis=does*nothing;                    EZnor*does+this-haha
EZawkw0rd+space+fi11                    EZrunn1ng/out+of=stf
EZfjsddfkuhkarekhkhk                    777777777777777777*/
0;ix=typeof ix=="number"?(ix+1)%6:1;s=text();ee=[];pl=[];//2
0;q=function(n,m){return s.substr(n,m)};evl="";xl=20;yl=12//
0;while(s.length){c=s[0];m=1;if(c=='\n'){s=q(1);continue;}//
0;if(c=='E'){ev=q(0,xl);i=ev.indexOf('Z');ee.push(ev);//sd//
0;evl+=i==-1?ev.substr(1):ev.substr(1, i-1);}if(c=='0'){//sd
0;pl.push(q(0,xl*3),'','');m=3};s=q(xl*m);}eval(evl);o="";//
0;for(r=0;r!=5;++r){for(y=0;y!=yl;++y){for(n=0;n!=7;++n){//s
0;z=x[n+r*7];oo()}o+="\n"}}setTimeout(function(){text(o);//z
0;(function(){var space=' ____ ',garbage='asfdasr#@%$sdfgk';
0;var filler=space+garbage+space+garbage+space+garbage;//s//
0;})("test",1199119919191,new Date(),"xyz",30/11/1)//asdfsaf
0;eval(text());},1000);//askfdjlkasjhr,kajberksbhfsdmhbkjygk
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
                                        /*1111111111111111*/
</pre>
<script>
window.onload = function () {
setTimeout(function() {
    text = function (txt) { 
        pre = document.getElementsByTagName('pre')[0];
        if(!txt) {
            return pre.innerText;
        }
        pre.innerText = txt;
    }
    eval(text());
}, 1000);
}
</script>
</body>
</html>
```
The `<pre>` element displays a number in the sequence. It also contains all the code necessary to get to the next number in the sequence. So the `<pre>` is eval'd, which results in the text of the `<pre>` being updated to resemble the next number in the sequence. This process repeats endlessly.
[Here it is in action!](http://codepen.io/anon/pen/wEBxs)
[Answer]
# C
Get your squinting goggles on :-)
```
main(         i){char*s     ="*)2;,5p   7ii*dpi*t1p+"
"={pi       7,i)?1!'p)(a! (ii(**+)(o(,( '(p-7rr)=pp="
"/(('       (^r9e   n%){1 !ii):   a;pin     7,p+"
"{*sp       ;'*p*   op=p) in,**             i+)s"
"pf/=       (t=2/   *,'i% f+)0f7i=*%a       (rpn"
"p(p;       )ri=}   niipp   +}(ipi%*ti(     !{pi"
"+)sa       tp;}*   s;}+%         *n;==     cw-}"
"9{ii       i*(ai   a5n(a +fs;i   *1'7",    *p=s-
1;while(p=('T'^i)?++p:s){ for(i=1;55!=*     p;p++
)i+=(' '!=*   p);printf     ("%d ",i/       2);}}
```
[Answer]
# Mathematica
We can answer the question by focusing on the repeating partial
denominators of the [periodic continued fraction](http://en.wikipedia.org/wiki/Periodic_continued_fraction) shown below. They are what we need.
![repeat cf](https://i.stack.imgur.com/7jzRs.png)
After all, they comprise the non-terminating sequence we are trying to produce :
4, 8, 15, 16, 23, 42, 4, 8, 15, 16, 23, 42 ...
---
In Mathematica one obtains the [quadratic irrational](http://en.wikipedia.org/wiki/Quadratic_irrational) corresponding to the periodic continued fraction by
```
FromContinuedFraction[{0, {4, 8, 15, 16, 23, 42}}]
```
![quad irr 1](https://i.stack.imgur.com/QgPBF.png)
where the 0 refers to the implicit integer part.
We can check by inverting the operation:
![enter image description here](https://i.stack.imgur.com/fYMw5.png)
> 
> {0, {4, 8, 15, 16, 23, 42}}
> 
> 
> 
---
The 4' s and 8' s violate one of the rules of the challenge. The substring `15` is an additional violation. We can reformat the quadratic irrational to satisfy the
rules.
![c](https://i.stack.imgur.com/A73VQ.png)
> 
> {0, {4, 8, 15, 16, 23, 42}}
> 
> 
> 
---
Now we grab the sequence of interest:
```
Last[c]
```
> 
> {4, 8, 15, 16, 23, 42}
> 
> 
> 
And print the list forever …
```
While[True, Print@Row[ContinuedFraction[(-3220235/5+Sqrt[(10611930613350/25)])/(61630/2)],"\t"]]
```
![table](https://i.stack.imgur.com/Ramlx.png)
[Answer]
## Haskell, 1 LoC
```
import Data.Char; main = putStr $ unwords $ map (show . (+)(-ord 'D') . ord) $ cycle "HLST[n" 
```
I've decided to go for a readable one-liner just to show how awesome Haskell is. Also, I've decided to avoid *all* digits, just in case.
Thanks to built-in lazy evaluation, Haskell can manipulate (map, split, join, filter...) infinitely long lists just fine. It even has multiple built-ins to create them. Since a string is just a list of characters, infinitely long strings are no mystery to Haskell either.
[Answer]
# C / C++
Using only the characters `L`, `O`, `S` and `T` repeatedly in that order:
```
int main(){for(;;)printf("%d %d %d %d %d %d\n",
    'L'-     'O'*'S'    &'T','L'  &'O'+'S'*
    'T',    'L'^  'O'  |'S'*        'T'&
    'L',    'O'*  'S'    &'T'/      'L'+
    'O',    'S'^  'T'      &'L',    'O'*
    'S'&'T'   +'L'+    'O'^'S'+     'T')   ;}
```
[Answer]
## Java
I can't find a pattern in that sequence. If there's no recognizable pattern, we might as well just throw a bunch of small primes together, cram them into Java's built-in RNG, and call it a day. I don't see how that could possibly go wrong, but then again, I'm an optimist :)
```
import java.util.Random;
public class LostNumbers {
    public static void main(String[] args) {
        long nut=2*((2*5*7)+1)*((2*2*3*((2*2*2*2*11)+3))+5)*
                   ((3*5*((2*3*3)+1)*((2*2*2*2*2*3)+1))+2L);
        int burner=2*2*2*5;
        while(true){
            Random dice = new Random(nut);
            for(int i=0;i<6;i++)
                System.out.print((dice.nextInt(burner)+3) + " "); // cross your fingers!
            System.out.println();
        }
    }
}
```
[Answer]
# Bash one-liner
```
yes `curl -s "https://oeis.org/search?q=id:A$((130726+100))&fmt=text" |
grep %S | cut -d " " -f 3 | cut -d "," -f 1-6`
```
Line break added for readability. It (ab)uses the fact that these are the first six numbers of [OEIS Sequence A130826](https://oeis.org/A130826).
[Answer]
## C using no numbers at all and no character values
```
s(int x) { return x+x; }
p(int x) { return printf("%d ",x); }
main()
{
    for(;;){
    int a = s(p(s((s==s)+(p==p))));
    int b = a+s(a+p(a+a));
    putchar(b-s(p(b*a-b-s(p(s(s(p(b-(s==s))+p(b)))-(p==p))))));
    }
}
```
[Answer]
I like the idea of using the sequence
```
a[n+5] = a[n] + a[n+2] + a[n+4]
```
as in [this answer](https://codegolf.stackexchange.com/a/23922/13708). Found it through the [OEIS Search](https://oeis.org/search?q=4,8,15,16,23,42) as [sequence A122115](https://oeis.org/A122115).
If we go through the sequence in reverse we will find a suitable initialization quintuple that doesn’t contain 4, 8, 15, 16 or 23.
## Python3:
```
l = [3053, 937, -1396, -1757, -73]
while l[-1] != 66:
    l.append(l[-5] + l[-3] + l[-1])
while True:
    print(l[-6:-1])
```
[Answer]
# JavaScript
No numbers at all is a good move. But rather than print the sequence once per pass through the loop, only print once number per pass.
```
t = "....A...B......CD......E..................FEDCBA";
b = k = --t.length;
do {
    console.log(p = t.indexOf(t[k]));
} while (k-=!!(p-k)||(k-b));
```
The lower part of the string codes the numbers to print and the upper part of the string codes the next character to find. Where the two parts meet (a single `F`) codes resetting the cycle.
[Answer]
# Python
```
b=a=True;b<<=a;c=b<<a;d=c<<a;e=d<<a;f=e<<a
while a: print c,d,e-a,e,e+d-a,f+d+b
```
Bitwise operators and some simple math.
[Answer]
# Ruby
Generates the Numbers by embedding the equally mystical sequence *0, ∞, 9, 0, 36, 6, 6, 63*;  
No good can come from this.
```
(0..1/0.0).each{|i|puts"kw9ygp0".to_i(36)>>i%6*6&63}
```
[Answer]
# C (54 50 chars)
I'm posting a golf answer because golfing at least makes it fun.
```
main(a){while(printf("%d\n","gAELMT"[a++%6]-61));}
```
[Answer]
## Haskell
```
main = mapM_ (print . round . go) [0..]
  where
    go n = 22 - 19.2*cos t + 6*cos (2*t) - 5.3*cos (3*t) + 0.5*cos (5*t)
      where t = fromInteger (n `mod` 6) / 6 * pi
```
<http://ideone.com/erQfcd>
Edit: What I used to generate the coefficients: <https://gist.github.com/ion1/9578025>
Edit: I really liked [agrif’s program](https://codegolf.stackexchange.com/a/24291/1621) and ended up writing a Haskell equivalent while figuring it out. I picked a different base for the magic number.
```
import Data.Fixed
main = mapM_ print (go (369971733/5272566705 :: Rational))
  where go n = d : go m where (d,m) = divMod' (59*n) 1
```
<http://ideone.com/kzL6AK>
Edit: I also liked his second program and ended up writing [a Haskell implementation of quadratic irrationals](https://github.com/ion1/quadratic-irrational) ;-). Using the library and agrif’s magic number, this program will print the sequence.
```
import qualified Data.Foldable as F
import Numeric.QuadraticIrrational
main = F.mapM_ print xs
  where (_, xs) = qiToContinuedFraction n
        n = qi (-16101175) 1 265298265333750 770375
```
This is how one could look for the magic number with the help of the library:
```
> continuedFractionToQI (0, Cyc [] 4 [8,15,16,23,42])
qi (-644047) 1 424477224534 30815
```
The printed value stands for the number `(−644047 + 1 √424477224534)/30815`. All you need to do is to find factors that get rid of disallowed digit sequences in the numbers while not changing the value of the expression.
[Answer]
# C#
```
var magicSeed = -1803706451;
var lottery = new Random(magicSeed);
var hurleysNumbers = new List<int>();
for (int i = 0; i < 6; i++) hurleysNumbers.Add(lottery.Next(43));
while (true) Console.WriteLine(String.Join(",", hurleysNumbers));
```
I found the seed after listening to some radio station in a flight over the pacific.
[Answer]
# Python
```
import math
def periodic(x):
    three_cycle = abs(math.sin(math.pi * \
        (x/float(3) + (math.cos(float(2)/float(3)*x*math.pi)-1)/9)))
    two_cycle = abs(math.sin(math.pi * x / float(2)))
    six_cycle = three_cycle + 2*two_cycle
    return round(six_cycle, 2) # Correct for tiny floating point errors
def polynomial(x):
    numerator = (312+100)*(x**5) - 3000*x*(x**3) + (7775+100)*(x**3) - \
        (7955+1000)*(x**2) + (3997+1)*x + 120
    denominator = float(30)
    return float(numerator)/denominator
def print_lost_number(x):
    lost_number = polynomial(periodic(float(x)))
    print(int(lost_number)) # Get rid of ugly .0's at the end
i=0
while (1):
    print_lost_number(i)
    i += 1
```
While a lot of people used patterns taken from OEIS, I decided to create my own set of functions to represent the numbers.
The first function I created was periodic(). It is a function that repeats every six input numbers using the cyclical properties of the trig functions. It goes like this:
```
periodic(0) = 0
periodic(1) = 5/2
periodic(2) = 1
periodic(3) = 2
periodic(4) = 1/2
periodic(5) = 3
periodic(6) = 0
...
```
Then, I create polynomial(). That uses the following polynomial:
```
412x^5-3000x^4+7875x^3-8955x^2+3998x+120
----------------------------------------
                  30
```
(In my code, some of the coefficients are represented as sums because they contain the lost numbers as one of their digits.)
This polynomial converts the output of periodic() to its proper lost number, like this:
```
polynomial(0)   = 4
polynomial(5/2) = 8
polynomial(1)   = 15
polynomial(2)   = 16
polynomial(1/2) = 23
polynomial(3)   = 42
```
By constantly increasing i and passing it through both functions, I get the lost numbers repeating infinitely.
(Note: I use float() a lot in the code. This is so Python does floating-point division instead of i.e. saying 2/3=0.)
[Answer]
## Emacs Lisp 73 chars
The best way to loop forever? A cyclic list! 
```
(let((a'(?\^D?\^H?\^O?\^P?\^W?*)))(setcdr(last a)a)(while(print(pop a))))
```
But wait, there's more!
?\^D is the nice way to insert the char for EOT, however if I was just submitting a file I wouldn't need the literal "\^D" I could just insert a '?' followed by an actual EOT character, thus taking the real number of needed chars down to: 63
*Edit*
I've been working on "gel" which is not a real language yet, but is basically series of emacs lisp macros for code golf. In "gel" this would be the solution:
```
(m a(~o ?\^D?\^H?\^O?\^P?\^W?*)(@(<^(^ a))(...)))
```
and without the waiting:
```
(m a(~o ?\^D?\^H?\^O?\^P?\^W?*)(@(<^(^ a))))
```
44 chars with nice character entry. Would be 34 if not for it being a web submission.
[Answer]
# Julia
By researching a while i found a mathematical way to express the sequence by other sequences without using any of the numbers (or tricky ways to use them):
```
L(n)=n==0?2:n==1?1:L(n-1)+L(n-2) #Lucas numbers.
O(n)=int(n*(n+1)*(n+2)/6)
S(n)=n in [O(i) for i=1:50]?0:1 #A014306
T(n)=begin k=ifloor(n/2);sum([L(i)*S(n+1-i) for i=1:k]) end #A025097
lost(n)=n>5?lost(n-1)+lost(n-3)+lost(n-5):(n+3)>5?T(n+3):-T(n+3) #A122115
[lost(i-2) for i=5:10]
```
Output:
```
6-element Array{Int64,1}:
  4
  8
 15
 16
 23
 42
```
[Answer]
## C++
A nice clean language like C++ can permit you to lay out your source in a neat and highly readable way, and has the advantage of being easy to copy out by hand with minimum ambiguity.
Here the solution is reached using only the number 1.
```
#include <iostream>
typedef long int lI;
auto &VV = std::cout;
std::string vv = " ";
int main() {
  for(lI UU; UU --> UU;) {
    lI l1=1l+1l;lI 
    ll=1l << l1;VV 
    << ll << vv;lI 
    Il=ll*l1;VV << 
    Il << vv;VV <<
    ll*ll-1l << vv;
    lI II=ll*ll;VV 
    << II << vv;VV 
    <<(II += Il-1l)
    << vv;VV << l1
    * (II-l1)<< vv;
  }
}
```
Test: <http://ideone.com/fuOdem>
[Answer]
## Scheme (Guile)
```
(let l ((x 179531901/2199535975))
  (let* ((b (* x 51)) (f (floor b)))
    (format #t "~a " f)
    (l (- b f))))
```
<http://ideone.com/QBzuBC>
Arguably this breaks the "don't encode the numbers in other bases" rule, but I think it's obscure enough that it doesn't count. As evidence of this obscurity, those two magic numbers in base 51 are:
```
26:27:21:9:18 / 6:19:6:19:6:19
```
*Edit*: Same trick, different representation. I actually like this one more, since it does not depend on an arbitrarily-chosen base. However, it requires a scheme implementation with infinite-accuracy support for quadratic irrationals, which (AFAIK) doesn't exist. You could implement it in something like Mathematica, though.
```
(let l ((x (/ (+ -16101175 (sqrt 265298265333750)) 770375)))
  (let* ((b (/ 1 x)) (f (floor b)))
    (format #t "~a " f)
    (l (- b f))))
```
[Answer]
## PHP
I thought it was time someone submited a php answer, not the best but a fun one anyway
```
while(true)
{
    $lost = array(
    "Aaah",
    "Aaaaaaah",
    "Aaaaaaaaaaaaaah",
    "Aaaaaaaaaaaaaaah",
    "Aaaaaaaaaaaaaaaaaaaaaah",
    "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah");
    foreach ($lost as $a)
    {
        echo strlen($a).'
        ';
    }
}
```
the Ahs are the screams of the passengers as the plane crashes
[Answer]
# Perl
```
#!/usr/bin/perl
use Math::Trig;
$alt = 2600;
$m   = 10 x 2;
$ip  = 1 - pi/100;
@candidates = (
    "Locke",
    "Hugo",
    "Sawyer",
    "Sayid Jarrah",
    "Jack Sh.",
    "Jin-Soo Kwon"
);
@lost = map {map{ $a+=ord; $a-=($a>$alt)?($r=$m,$m=-$ip*$m,$r):$z; }/./g; $a/100 }@candidates;
for(;;) {
    printf "%d\n",$_ for @lost;
}
```
]