Skip to main content
deleted 5 characters in body
Source Link
asgallant
  • 309
  • 1
  • 5
o=>(n=0,Arrayo=>Array(9).fill('')fill``.map(x=>(n=n*10+1,x+(x+n*nn=n*10+1)*n).replace(0,1))),n=‌​0)
o=>(                               // o is unused input (saves 1 byte vs ())
    n=0,                          // n^2 is the rhombus number at each stage
    Array(9)                      // create an array of length 9
        .fill('')fill``                   // fill it with empty strings
                                  // we must fill it with something, because map skips
                                  // empty entries
        .map(                     // loop over the array and return a new array with the
                                  // values returned by the callback
            x=>(                  // x is the element in the array
                (x+(n=n*10+1,       )*n)  // make n 1, 11, 111, 1111, etc, and get the string
                (x+n*n)           // get the string    // value of n^2
                    .replace(0,1) // replace 0's with 1's (necessary for
                                  // 12345678987654321, because
                                  // 111111111^2 = 12345678987654320 in javascript)
            ),
        )    n=0                   // n^2 is the rhombus number at each stage
        )
o=>(n=0,Array(9).fill('').map(x=>(n=n*10+1,(x+n*n).replace(0,1))))
o=>(                              // o is unused input (saves 1 byte vs ())
    n=0,                          // n^2 is the rhombus number at each stage
    Array(9)                      // create an array of length 9
        .fill('')                 // fill it with empty strings
                                  // we must fill it with something, because map skips
                                  // empty entries
        .map(                     // loop over the array and return a new array with the
                                  // values returned by the callback
            x=>(                  // x is the element in the array
                n=n*10+1,         // make n 1, 11, 111, 1111, etc
                (x+n*n)           // get the string value of n^2
                    .replace(0,1) // replace 0's with 1's (necessary for
                                  // 12345678987654321, because
                                  // 111111111^2 = 12345678987654320 in javascript)
            )
        )
)
o=>Array(9).fill``.map(x=>(x+(n=n*10+1)*n).replace(0,1),n=‌​0)
o=>                               // o is unused input (saves 1 byte vs ())
    Array(9)                      // create an array of length 9
        .fill``                   // fill it with empty strings
                                  // we must fill it with something, because map skips
                                  // empty entries
        .map(                     // loop over the array and return a new array with the
                                  // values returned by the callback
            x=>(                  // x is the element in the array
                (x+(n=n*10+1)*n)  // make n 1, 11, 111, 1111, etc, and get the string
                                  // value of n^2
                    .replace(0,1) // replace 0's with 1's (necessary for
                                  // 12345678987654321, because
                                  // 111111111^2 = 12345678987654320 in javascript)
            ),
            n=0                   // n^2 is the rhombus number at each stage
        )
Source Link
asgallant
  • 309
  • 1
  • 5

Javascript 66 bytes

Returns an array of strings representing the numbers in the sequence (necessary because 12345678987654321 is too large to be accurately represented as an int in Javascript)

o=>(n=0,Array(9).fill('').map(x=>(n=n*10+1,(x+n*n).replace(0,1))))

Explanation

o=>(                              // o is unused input (saves 1 byte vs ())
    n=0,                          // n^2 is the rhombus number at each stage
    Array(9)                      // create an array of length 9
        .fill('')                 // fill it with empty strings
                                  // we must fill it with something, because map skips
                                  // empty entries
        .map(                     // loop over the array and return a new array with the
                                  // values returned by the callback
            x=>(                  // x is the element in the array
                n=n*10+1,         // make n 1, 11, 111, 1111, etc
                (x+n*n)           // get the string value of n^2
                    .replace(0,1) // replace 0's with 1's (necessary for
                                  // 12345678987654321, because
                                  // 111111111^2 = 12345678987654320 in javascript)
            )
        )
)