A zairja (Arabic: زايرجة; also transcribed as zairjah, zairajah, zairdja, zairadja, and zayirga) was a device used by medieval Arab astrologers to generate ideas by mechanical means. The name may derive from a mixture of the Persian words zaicha ("horoscope; astronomical table") and daira ("circle").from Wikipedia
Ibn Khaldun described it as: "a branch of the science of letter magic, practiced among the authorities on letter magic, is the technique of finding out answers from questions by means of connections existing between the letters of the expressions used in the question. They imagine that these connections can form the basis for knowing the future happenings they want to know." He suggests that rather than being supernatural it works "from an agreement in the wording of question and answer ... with the help of the technique called the technique of 'breaking down'" (i.e. algebra). By combining number values associated with the letters and categories, new paths of insight and thought were created.
According to Ibn Khaldun the most detailed treatment of it is a pseudographical work "Za'irajah of the World" attributed to as-Sabti, which contains operating instructions in hundreds of lines of verse, beginning:Select a star rise. Figure out its signs.A manuscript in Rabat recounts Ibn Khaldun's introduction to the machine by Al-Marjānī in 1370 (772 AH), and claims that it was a traditional and ancient science. When Ibn Khaldun expressed skepticism, the pair asked the instrument how old it was, and was told by the machine it was invented by the prophet Idris (identified with the Biblical Enoch).
Reverse its root. Straighten it out with the cycle.
Someone will perceive those things. He will achieve his purpose
And be given their letters in whose arrangement the evidence lies...
It has been suggested that Catalan-Majorcan mystic, Ramon Llull in his travels and studies of Arab culture, became familiar with the zairja, and used it as a prototype for his invention of the Ars Magna.