OFFSET
0,1
COMMENTS
The sequence seems to exist for all n except positive powers of 10.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..2999 (terms 0..544 from Pieter Post)
FORMULA
a(n) = min{b >= 2 | abs(A225693(n^b)) = n} or 0 if the min does not exist.
a(10^k) = 0 for k > 0.
EXAMPLE
a(2) = 6 since 2^6 = 64 => |6-4| = 2.
a(3) = 11 since 3^11 = 177147 => |1-7+7-1+4-7| = 3.
a(12) = 3 since 12^3 = 1728 => |1-7+2-8| = 12.
MATHEMATICA
a[n_]:=Module[{b=2}, If[n>1&&IntegerQ[Log10[n]], b=0, While[s={1}; Do[AppendTo[s, (-1)^(k)], {k, 1, IntegerLength[n^b]-1}]; Abs[Total[IntegerDigits[n^b]*s]]!=n, b++]]; b]; Array[a, 71, 0] (* James C. McMahon, Nov 03 2025 *)
PROG
(Python)
from gmpy2 import digits
from itertools import count
def a(n):
if str(n).strip('0') == '1': return 2*int(n == 1)
return next(b for b in count(2) if n==abs(sum(-d if i&1 else d for i, d in enumerate(map(int, digits(n**b))))))
print([a(n) for n in range(101)]) # Michael S. Branicky, Oct 25 2025
(PARI) ispt(n) = if (n>1, 10^valuation(n, 10) == n);
as(n) = my(d=digits(n)); abs(sum(i=1, #d, d[i]*(-1)^i));
a(n) = if (ispt(n), 0, my(b=2); while (as(n^b) != n, b++); b); \\ Michel Marcus, Oct 24 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pieter Post, Oct 24 2025
STATUS
approved
