login
A350709
Modified Sisyphus function of order 3: a(n) is the concatenation of the number of digits in n with the number of digits of n congruent to k modulo 3 for each k from 0 to 2 in turn.
4
1100, 1010, 1001, 1100, 1010, 1001, 1100, 1010, 1001, 1100, 2110, 2020, 2011, 2110, 2020, 2011, 2110, 2020, 2011, 2110, 2101, 2011, 2002, 2101, 2011, 2002, 2101, 2011, 2002, 2101, 2200, 2110, 2101, 2200, 2110, 2101, 2200
OFFSET
0,1
COMMENTS
If we start with n and repeatedly apply the map i -> a(i), we eventually get the cycle {4031, 4112, 4220}
LINKS
M. E. Coppenbarger, Iterations of a modified Sisyphus function, Fib. Q., 56 (No. 2, 2018), 130-141.
EXAMPLE
11 has two digits, both congruent to 1 modulo 3, so a(11) = 2020.
a(20) = 2101.
a(30) = 2200.
a(1111123567) = 10262.
MAPLE
nd:= n -> 1 + ilog10(n):
nd(0):= 1:
cat4:= proc(a, b, c, d)
((a*10^nd(b)+b)*10^nd(c)+c)*10^nd(d)+d
end proc:
f:= proc(n) local L, i;
L:= convert(n, base, 10);
cat4(nops(L), seq(nops(select(t -> t mod 3 = i, L)), i=0..2))
end proc:
map(f, [$0..100]); # Robert Israel, Sep 07 2025
MATHEMATICA
fc[n_, m_]:={Count[Mod[IntegerDigits[n], 3], m]}; a[n_]:=FromDigits[Join[{Length[IntegerDigits[n]]}, fc[n, 0], fc[n, 1], fc[n, 2]]]; Array[a, 37, 0] (* James C. McMahon, Sep 07 2025 *)
PROG
(Python)
def a(n):
d, m = list(map(int, str(n))), [0, 0, 0]
for di in d: m[di%3] += 1
return int(str(len(d)) + "".join(map(str, m)))
print([a(n) for n in range(37)]) # Michael S. Branicky, Mar 28 2022
CROSSREFS
Sequence in context: A281039 A385708 A078199 * A271472 A147816 A050926
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved