3 deleted 2 characters in body
source | link

C, 8482 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++,c+=r==nb=1;++b<n-2;c+=r==n)for(a=n,r=0;a>0;a/=b)r=r*b+a%b;return c<2;!c;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

C, 84 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++,c+=r==n)for(a=n,r=0;a>0;a/=b)r=r*b+a%b;return c<2;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

C, 82 bytes

p(n,a,b,c,r){c=0;for(b=1;++b<n-2;c+=r==n)for(a=n,r=0;a>0;a/=b)r=r*b+a%b;return!c;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

2 edited body
source | link

C, 8684 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++,c+=r==n){for(a=n,r=0;a>0;a/=b)r=r*b+a%b;c+=r==n;}returnr=r*b+a%b;return c<2;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

C, 86 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++){for(a=n,r=0;a>0;a/=b)r=r*b+a%b;c+=r==n;}return c<2;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

C, 84 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++,c+=r==n)for(a=n,r=0;a>0;a/=b)r=r*b+a%b;return c<2;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).

1
source | link

C, 86 bytes

p(n,a,b,c,r){c=0;for(b=2;b<n;b++){for(a=n,r=0;a>0;a/=b)r=r*b+a%b;c+=r==n;}return c<2;}

Ideone it!

Explanation

This code reverses n in base b and stores in r:

for(a=n,r=0;a>0;a/=b)r=r*b+a%b;

The outer loop counts the number of bases from 2 to n-1 in which n is a palindrome.

If n is non-palindromic, the count would be 1 (n must be a palindrome in base n-1).