예제 #1
0
    bool Sn(ref LuckyStruct s, int displacement)
    {
        float n = (float)displacement - (s.Get_Mult() * number - s.Get_Shift());

        if (n < 0)
        {
            return(false);
        }

        float temp1 = Mathf.Sqrt((n + s.Get_1()) * s.Get_2());
        float temp2 = s.Get_3();

        return(Approximately(temp1 + temp2,                                                       // temp1 ± temp2 ≈ integer, ideally exact
                             Mathf.Round(temp1 + temp2)) ? true :
               Approximately(temp1 - temp2,
                             Mathf.Round(temp1 - temp2)));
    }
예제 #2
0
    LuckyStruct[] cont = new LuckyStruct[76];     //new LuckyStruct[35];

    void Start()
    {
        num = number;

        FetchPrimesList();

        cont[0]  = new LuckyStruct(1, 1, 1);      //a = 0*b + 1, c=1
        cont[1]  = new LuckyStruct(1, 3, 1);
        cont[2]  = new LuckyStruct(1, 5, 1);
        cont[3]  = new LuckyStruct(1, 7, 1);
        cont[4]  = new LuckyStruct(1, 9, 1);
        cont[5]  = new LuckyStruct(1, 11, 1);
        cont[6]  = new LuckyStruct(1, 13, 1);
        cont[7]  = new LuckyStruct(1, 15, 1);
        cont[8]  = new LuckyStruct(1, 17, 1);
        cont[9]  = new LuckyStruct(1, 19, 1);
        cont[10] = new LuckyStruct(1, 21, 1);
        cont[11] = new LuckyStruct(1, 23, 1);
        cont[12] = new LuckyStruct(1, 25, 1);
        cont[13] = new LuckyStruct(1, 27, 1);
        cont[14] = new LuckyStruct(1, 29, 1);
        cont[15] = new LuckyStruct(1, 31, 1);
        cont[16] = new LuckyStruct(1, 33, 1);
        cont[17] = new LuckyStruct(1, 35, 1);
        cont[18] = new LuckyStruct(1, 37, 1);
        cont[19] = new LuckyStruct(1, 39, 1);
        cont[61] = new LuckyStruct(1, 41, 1);
        cont[62] = new LuckyStruct(1, 43, 1);
        cont[63] = new LuckyStruct(1, 45, 1);
        cont[64] = new LuckyStruct(1, 47, 1);
        cont[65] = new LuckyStruct(1, 49, 1);
        cont[66] = new LuckyStruct(1, 51, 1);
        cont[67] = new LuckyStruct(1, 53, 1);
        cont[68] = new LuckyStruct(1, 55, 1);
        cont[69] = new LuckyStruct(1, 57, 1);
        cont[70] = new LuckyStruct(1, 59, 1);
        cont[71] = new LuckyStruct(1, 61, 1);
        cont[72] = new LuckyStruct(1, 63, 1);
        cont[73] = new LuckyStruct(1, 65, 1);
        cont[74] = new LuckyStruct(1, 67, 1);
        cont[75] = new LuckyStruct(1, 69, 1);

        //                        (1,3,1)
        cont[20] = new LuckyStruct(5, 7, 2);       //b = a + 2, c=int
        cont[21] = new LuckyStruct(9, 11, 3);
        cont[22] = new LuckyStruct(13, 15, 4);
        cont[23] = new LuckyStruct(17, 19, 5);
        cont[24] = new LuckyStruct(21, 23, 6);
        cont[25] = new LuckyStruct(25, 27, 7);
        cont[26] = new LuckyStruct(29, 31, 8);
        cont[27] = new LuckyStruct(33, 35, 9);
        cont[28] = new LuckyStruct(37, 39, 10);
        cont[29] = new LuckyStruct(41, 43, 11);
        cont[30] = new LuckyStruct(45, 47, 12);
        cont[31] = new LuckyStruct(49, 51, 13);
        cont[32] = new LuckyStruct(53, 55, 14);
        cont[33] = new LuckyStruct(57, 59, 15);
        cont[34] = new LuckyStruct(57, 59, 15);
        cont[35] = new LuckyStruct(57, 59, 15);
        cont[36] = new LuckyStruct(57, 59, 15);
        cont[37] = new LuckyStruct(57, 59, 15);
        cont[38] = new LuckyStruct(57, 59, 15);
        cont[39] = new LuckyStruct(57, 59, 15);

        //                        (1,5,1)
        cont[40] = new LuckyStruct(7, 17, 3);
        cont[41] = new LuckyStruct(13, 29, 5);       //b = a*2 + 3, c=odd
        cont[42] = new LuckyStruct(19, 41, 7);
        cont[43] = new LuckyStruct(25, 53, 9);
        cont[44] = new LuckyStruct(31, 65, 11);
        cont[45] = new LuckyStruct(37, 77, 13);

        //                        (5,7,2)
        cont[46] = new LuckyStruct(11, 19, 4);
        cont[47] = new LuckyStruct(17, 31, 6);       //b = a*2 - 3, c=even
        cont[48] = new LuckyStruct(23, 43, 8);
        cont[49] = new LuckyStruct(29, 55, 10);
        cont[50] = new LuckyStruct(35, 67, 12);

        //                        (1,7,2)
        cont[51] = new LuckyStruct(9, 31, 4);       //b = a*3 + 4
        cont[52] = new LuckyStruct(17, 55, 7);
        cont[53] = new LuckyStruct(25, 79, 10);

        //                        (7,17,3)
        cont[54] = new LuckyStruct(15, 41, 6);       //b = a*3 - 4
        cont[55] = new LuckyStruct(23, 65, 9);
        //

        cont[56] = new LuckyStruct(11, 49, 5);       //b = a*4 + 5
        //

        cont[57] = new LuckyStruct(19, 71, 8);       //b = a*4 - 5
        //

        cont[58] = new LuckyStruct(13, 71, 6);       //b = a*5 + 6

        cont[59] = new LuckyStruct(29, 41, 9);       //unknown
        cont[60] = new LuckyStruct(31, 49, 10);

        trans = this.gameObject.transform;

        InvokeRepeating("Generate2DValue", 1, 0.001f);
    }