login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A348730 Largest remainder of an n-digit number when divided by its sum of digits. 6
0, 15, 24, 31, 43, 49, 58, 69, 79, 86, 95, 103, 114, 124, 130, 142, 150, 159, 169, 177, 185, 195, 203, 214, 223, 231, 241, 249, 259, 267, 275, 286, 295, 303, 312, 321, 330, 340, 349, 357, 367, 375, 383, 394, 403, 411, 421, 429, 439, 448, 456, 465, 475, 482, 493, 501 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
When dividing a number by N, the remainder can be at most N - 1. The largest sum of digits that an n-digit number can reach is 9*n. According to this, a(n) < 9*n is always the case.
Is the sequence strictly increasing? a(n) is achieved by a single n-digit number when n = 2, 3, 5, 19, 24, 27, 32, 38, ... (Cf. A348900) - Chai Wah Wu, Nov 02 2021
LINKS
David A. Corneth, Table of n, a(n) for n = 1..1780 (first 820 terms from Chai Wah Wu)
David A. Corneth, PARI program
Heinrich Hemme, Was ist der größtmögliche Rest? Hemmes mathematische Rätsel, Oct 28 2021.
Volker Wagner, Kleine Rechnerei, Knobelforum, Jan 24 2020.
EXAMPLE
79 = 15 mod 16
799 = 24 mod 25
9599 = 31 mod 32
98999 = 43 mod 44
599999 = 49 mod 50
8999998 = 58 mod 61
etc.
MAPLE
sod:=proc(n) # sum of digits
local N;
N:=convert(n, base, 10);
add(i, i=N);
end;
a:=proc(k)local n, i;
for n from 1 to k do
maxR||n:=0: # largest remainder
for i from 10^(n-1) to 10^n-1 do
if i mod sod(i)>maxR||n then
maxR||n:=i mod sod(i);
fi;
od:
od:
return(seq(maxR||n, n=1..k));
end;
MATHEMATICA
a[n_] := Max[Mod[#, (Plus @@ IntegerDigits[#])] & /@ Range[10^(n - 1), 10^n - 1]]; Array[a, 7] (* Amiram Eldar, Oct 31 2021 *)
PROG
(Python)
def sd(n): return sum(map(int, str(n)))
def a(n): return max(n%sd(n) for n in range(10**(n-1)+1, 10**n))
print([a(n) for n in range(1, 7)]) # Michael S. Branicky, Oct 31 2021
(PARI) See Corneth link
(Python)
from functools import lru_cache
from sympy.combinatorics.partitions import IntegerPartition
from sympy.utilities.iterables import partitions, multiset_permutations
@lru_cache(maxsize=None)
def intpartition(n, m): return tuple(''.join(str(d) for d in IntegerPartition(p).partition+[0]*(m-s)) for s, p in partitions(n, k=9, m=m, size=True))
def A348730(n):
l, c, k = 9*n, 0, 10**(n-1)
while l-1 > c:
c = max(c, max(s % l for s in (int(''.join(q)) for p in intpartition(l, n) for q in multiset_permutations(p)) if s >= k))
l -= 1
return c # Chai Wah Wu, Nov 03-08 2021
CROSSREFS
Sequence in context: A269314 A269316 A081829 * A079721 A362812 A089952
KEYWORD
nonn,base
AUTHOR
Martin Renner, Oct 31 2021
EXTENSIONS
a(8)-a(10) from Michael S. Branicky, Oct 31 2021
More terms from David A. Corneth, Oct 31 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 09:15 EDT 2024. Contains 371967 sequences. (Running on oeis4.)