Talk:Deceptive numbers: Difference between revisions

no edit summary
m (nine entries)
No edit summary
 
Line 4:
All non-primes below 7<sup>2</sup> are divisible by 2, 3, or 5. So it is sufficient to start the search at 49. --[[User:Querfeld|Querfeld]] ([[User talk:Querfeld|talk]]) 14:01, 24 September 2023 (UTC)
 
Regarding the repunit '''R<sub>n-1</sub>''', the equation '''R<sub>n-1</sub> * 9 = 10<sup>n-1</sup> - 1''' is fulfilled. And if it is ensured, that '''n''' is not divisible by 3, then if '''R<sub>n-1</sub> * 9''' is divisible by '''n''', also '''R<sub>n-1</sub>''' is divisible by '''n'''. In that case, the check of '''R<sub>n-1</sub> mod n = 0''' can be simplified to '''10<sup>n-1</sup> mod n = 1''', which can be calculated via modular exponentiation, so that big integers are not required for this task.<br> --[[User:Querfeld|Querfeld]] ([[User talk:Querfeld|talk]]) 19:09, 26 September 2023 (UTC)
: Yep, that certainly works! (actually nine entries were already doing just that last year) --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 23:52, 26 September 2023 (UTC)
With:: Indeed (actually, the [[wp:FermatOCaml, primalityPython, test]]and beingC '''a<sup>n-1</sup>implementations modhave nbeen =written 1''',by whereme; '''[[gcd]](a,translations nfollowed), =I 1'''just wanted to explain, ithow becomesthis obviousworks — to encourage implementations in languages, that don't provide native BigInt support (32-bit precision is sufficient for the first 50 ''deceptive numbers''). areAnd athe subsetprinciple ofhas already been shown on the [[Fermathttps://oeis.org/A000864 pseudoprimes]OEIS page] to(just basethat they ''mod''a =by 10''',n with* the9''', multiplesinstead of ruling out factor 3 filteredin outadvance). ('''10<sup>x</sup>But -it 1'''is alreadyoften rulesfaster outto do the multiplesFermat ofprimality 2test and''before'' 5)the full primality check. --[[User:Querfeld|Querfeld]] ([[User talk:Querfeld|talk]]) 1910:0959, 2627 September 2023 (UTC)
With the [[wp:Fermat primality test]] being '''a<sup>n-1</sup> mod n = 1''', where '''[[gcd]](a, n) = 1''', it becomes obvious, that the ''deceptive numbers'' are a subset of the [[Fermat pseudoprimes]] to base '''a = 10''', with the multiples of 3 filtered out ('''10<sup>x</sup>''' already rules out the multiples of 2 and 5). --[[User:Querfeld|Querfeld]] ([[User talk:Querfeld|talk]]) 19:09, 26 September 2023 (UTC)
559

edits