Data update
This commit is contained in:
parent
796d366b97
commit
35bcdeebf8
504 changed files with 7045 additions and 610 deletions
|
|
@ -1,23 +1,24 @@
|
|||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned modpow(unsigned b, unsigned e, unsigned m)
|
||||
uint32_t modpow(uint32_t b, uint32_t e, uint32_t m)
|
||||
{
|
||||
unsigned p;
|
||||
uint32_t p;
|
||||
for (p = 1; e; e >>= 1) {
|
||||
if (e & 1)
|
||||
p = p * b % m;
|
||||
b = b * b % m;
|
||||
p = (uint64_t)p * b % m;
|
||||
b = (uint64_t)b * b % m;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
int is_deceptive(unsigned n)
|
||||
int is_deceptive(uint32_t n)
|
||||
{
|
||||
unsigned x;
|
||||
if (n & 1 && n % 3 && n % 5) {
|
||||
uint32_t x;
|
||||
if (n & 1 && n % 3 && n % 5 && modpow(10, n - 1, n) == 1) {
|
||||
for (x = 7; x * x <= n; x += 6) {
|
||||
if (!(n % x && n % (x + 4)))
|
||||
return modpow(10, n - 1, n) == 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -25,10 +26,11 @@ int is_deceptive(unsigned n)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
unsigned c, i = 49;
|
||||
for (c = 0; c != 50; ++i) {
|
||||
if (is_deceptive(i)) {
|
||||
printf(" %u", i);
|
||||
uint32_t n = 49;
|
||||
unsigned int c;
|
||||
for (c = 0; c != 500; ++n) {
|
||||
if (is_deceptive(n)) {
|
||||
printf(" %" PRIu32, n);
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue