OFFSET
1,2
COMMENTS
Motivation: observed from 10% consumption-tax price rounding.
Leading zeros are not allowed.
If T = floor((11/10)*n + 1/2), then necessary conditions for a k-digit solution are: (i) T < 10^k (no carry to a new digit), (ii) T == n (mod 9), (iii) the multisets of digits of n and T coincide.
LINKS
Masato Wada, Table of n, a(n) for n = 1..484.
FORMULA
Let T(n) = floor((11*n + 5)/10). Then n is a term iff length(n) = length(T(n)) and sort(digits(n)) = sort(digits(T(n))).
EXAMPLE
3598 is a term since T(3598) = floor((11/10)*3598 + 0.5) = 3958, a digit permutation of 3598.
89 is a term since T(89) = 98.
MAPLE
taxround := n -> floor(11*n/10 + 1/2):
isA := proc(n) local t, dn, dt;
t := taxround(n);
dn := convert(n, base, 10); dt := convert(t, base, 10);
if nops(dn) <> nops(dt) then return false fi;
sort(dn) = sort(dt)
end:
select(isA, [$1..10000]);
MATHEMATICA
T[n_] := Floor[11 n/10 + 1/2];
isA[n_] := With[{t = T[n]},
IntegerLength[n] == IntegerLength[t] &&
Sort[IntegerDigits[n]] === Sort[IntegerDigits[t]]
];
Select[Range[1, 10000], isA]
PROG
(Python)
def T(n): return (11*n + 5)//10
def ok(n):
s, t = str(n), str(T(n))
return len(s) == len(t) and sorted(s) == sorted(t)
print([k for k in range(1, 10**4) if ok(k)])
(Python)
from itertools import count, islice
def A391471_gen(): # generator of terms
return filter(lambda n:sorted(str(n))==sorted(str(11*n+5)[:-1]), count(1))
(PARI)
T(n)=(11*n+5)\10;
isA(n)=
{
my(t=T(n));
if(#digits(n)!=#digits(t), return(0));
vecsort(digits(n))==vecsort(digits(t))
};
select(isA, [1..10000])
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Masato Wada, Dec 14 2025
STATUS
approved
