Skip to content

LAPCoder/A368245-sequence

Repository files navigation

A368245 sequence calculator

This program is a bit of fun experiments around the OEIS A368245 sequence. It finds every number where the sum of the digits minus an exponent n is equal to the n-root of the number.

Example: 25 = 5² and 2+5 - 7 = 5.

21936950640377856000000000000000000000 is the largest number available on OEIS but i found MUCH larger numbers. The main C++ program computes only in base 16 (hexadecimal) for optimization purpose.

A very large number found is: 10724857486986553660805148050162674058124174741992377994020085467289684512278681 47750563367480358627385835519125674011416091550450820045086457392411728166833488 20266235279111054046057663612159189268057438515882057527345185514925112118484946 35070588227758105663792555151308726989443122414196887087731610371674924393709738 67758419560299876038008746014898781689558006532784498375563211476129339231736813 02432977900413156248560180917488051207897331136630269967223585680160823391880308 07305740066955433534640012554870978531756748720976352446448199299030853123540582 55484983564613520296269915489162987360733641025793881661581199617535869512767440 29084231835626608637200675898219909744015766427748227353963211613626535719208105 19880668797490647234777255997387874417736413659634800898299409421117699651955627 77927930667176867448302442129723108967192532040566325145896473043708344484158536 68338846124832641046490454484531816931526778759217381953328587157884070593958110 23775699592233359076483657632146645653827700046131486216180412006904201767777589 17860896598458925158557242359808 (n=291): root=4792, hexadecimal_sum=5083, 4792 == 5083-291

28750990537194645757551024945194241956925376511645449373861630488503789289784117 89888639334803577473856464076000396118222406682516500566974961403771690664040408 44057575626036414230283127404597917418811887010496993085838090266351489106731805 82957993289888831790405494911401149119763779278895299263054377276443260535462385 81895107890196126684299782546336969495401045027269613049321425113694384539752641 05532131684357211246140631485185491544292996334184880852367168454709652673133853 81215179707481439194791839873146024842453316630928472940352578932125119103081874 19314632461904351038759853968677672021541670986535568632053676111882188943834012 44973356158152845321861024160733724642107045256902649634223262267742243212619361 21477666207812364481605011008700422874951506344494350438216200412831174097168462 51900223442779091466936162606828494956788705976498892693576141807538487461703892 86989759664453774194308971064202751752741915566054608848299334527009869815854568 22511357160732150949234234320079427004988909158219434538133947021154396683373756 72002213832151693112253243092638764454101076759183594625179078477904389333697758 99768217138553516166645141225528634371258820333518949891936460370849877676748084 43430716956611637997498479751609514664206060948642401417158317612902088961667019 75367631753785932030200672338011755057445217695136959367611687340092183994141408 30357817710350468923022713242260925135926924326561305972834100568130701676040543 43720500464902791413946338573927798196329771507444435784767575213554614642625177 01458488811081649457647388253738733077978590798635228131024431408336869600158801 42214870855420436254616991315433630943824942737125406821884227187278499795583642 48949399175980038500449689409313634449401397248427741617797816062423172100025937 44972390988823530219219163061995222772303432070042989129892833789461031463961988 18183720597857995305306704285250331063539748789967886177815713843576302509546749 8344543675912551452372893696 (n=488): root=9788, hexadecimal_sum=10276, 9788 == 10276-488

The C++ uses the wonderful GMP library to compute very large numbers. It is also multithreaded.

You can find the compilation command directly on the beginning of the source code. To switch the program from hexadecimal (default) to decimal mode, add -DDEC. It also supports octal (-DOCT) mode. at the compilation (more info on the top of the code).

Command to execute alone:

./sequence_SIMD 10000 500 > out.pgm

where 1000 is the max base and 300 is the max exp (base^exp). out_hex is the graph output: #000 is a match, dark is close, white is far. It also outputs in stderr the matches.

There is also a Python script to verify the numbers found

(./sequence_SIMD 5000 300 > out.pgm >/dev/null) 2>&1 | python checker.py --base 16

But to use the full sped of the CPP program, you should use run.sh. The Python is VERY slow with HUGE numbers, like the second one shown (2875.........3696).

The file numbers_found.log contains only numbers checked by the Python script but the C++ code can give you numbers MUCH larger.

The 2 000x00 images seems wrong; they were made using doubles so there might be imprecise and they were not checked. On the other hand, I don't understant why there are weird lines on the outs, both for hex and decimal.

I have the original program that used u64 that was 36ko, now it's 15ko compiled with -O3.

Licensied under the GPL-v3 license.

About

A small program to compute the A368245 OEIS sequence

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors