[go: up one dir, main page]

login
Search: a003132 -id:a003132
     Sort: relevance | references | number | modified | created      Format: long | short | data
Numbers that are both happy (A007770) and elated (A376272).
+0
1
1, 10, 13, 97, 100, 103, 130, 226, 262, 319, 356, 365, 391, 556, 565, 907, 970, 1000, 1003, 1030, 1122, 1177, 1188, 1212, 1221, 1222, 1277, 1300, 1339, 1393, 1448, 1478, 1484, 1487, 1557, 1575, 1717, 1727, 1748, 1755, 1771, 1772, 1784, 1818, 1844, 1847, 1874
OFFSET
1,2
COMMENTS
Every power of 10 is in this sequence, as both the sum of squared digits map (A003132) and the map A376270 map powers of 10 to 1.
PROG
(Python)
def ssd(n): return sum(int(d)**2 for d in str(n))
def f(n): return (d:=list(map(int, str(n))))[0] * sum(di*di for di in d)
def happy(n):
if n == 1: return True
s = list(map(int, str(n)))
while n not in [1, 4]: n = ssd(n) # iterate until fixed point or cycle
return n == 1
def elated(n):
if n == 1: return True
traj = {n}
while (n:=f(n)) not in traj: traj.add(n)
return 1 in traj
def ok(n): return happy(n) and elated(n)
print([k for k in range(1, 2001) if ok(k)]) # Michael S. Branicky, Oct 16 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. Bradley Fox, Nathan Fox, Helen Grundman, Rachel Lynn, Changningphaabi Namoijam, Mary Vanderschoot, Oct 15 2024
STATUS
approved
Sum of squares of the decimal digits of the n-th prime.
+0
2
4, 9, 25, 49, 2, 10, 50, 82, 13, 85, 10, 58, 17, 25, 65, 34, 106, 37, 85, 50, 58, 130, 73, 145, 130, 2, 10, 50, 82, 11, 54, 11, 59, 91, 98, 27, 75, 46, 86, 59, 131, 66, 83, 91, 131, 163, 6, 17, 57, 89, 22, 94, 21, 30, 78, 49, 121, 54, 102, 69, 77, 94, 58, 11
OFFSET
1,1
FORMULA
a(n) = A003132(A000040(n)).
EXAMPLE
For n=7, the 7th prime = 17 and those digits 1^2 + 7^2 = 50 = a(7).
MATHEMATICA
a[n_]:=Norm[IntegerDigits[Prime[n]]]^2; Array[a, 64] (* Stefano Spezia, Oct 03 2024 *)
PROG
(PARI) a(n) = norml2(digits(prime(n))); \\ Michel Marcus, Oct 03 2024
(Python)
from sympy import prime
def A376714(n): return sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[int(d)] for d in str(prime(n)) if d>'0') # Chai Wah Wu, Oct 04 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Katie Khan, Oct 02 2024
STATUS
approved
Sum of squares of the decimal digits of 2^n.
+0
1
1, 4, 16, 64, 37, 13, 52, 69, 65, 30, 21, 84, 133, 150, 126, 162, 131, 64, 77, 177, 191, 164, 139, 301, 225, 113, 266, 197, 231, 269, 209, 275, 404, 450, 443, 371, 426, 332, 461, 487, 413, 288, 266, 396, 346, 382, 426, 404, 463, 393, 514, 528, 517, 569, 584
OFFSET
0,2
FORMULA
a(n) = A003132(A000079(n)).
EXAMPLE
For n=4, 2^4 = 16 and those digits 1^2 + 6^2 = 37 = a(4).
MATHEMATICA
a[n_]:=Norm[IntegerDigits[2^n]]^2; Array[a, 55, 0] (* Stefano Spezia, Sep 06 2024 *)
PROG
(PARI) a(n) = norml2(digits(2^n)); \\ Michel Marcus, Sep 06 2024
(Python)
def A375976(n): return sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[int(d)] for d in str(1<<n) if d>'0') # Chai Wah Wu, Sep 30 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Luca Khan, Sep 04 2024
STATUS
approved
a(n) is the product of the leading digit of n and the sum of the squares of its digits.
+0
9
0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1, 2, 5, 10, 17, 26, 37, 50, 65, 82, 8, 10, 16, 26, 40, 58, 80, 106, 136, 170, 27, 30, 39, 54, 75, 102, 135, 174, 219, 270, 64, 68, 80, 100, 128, 164, 208, 260, 320, 388, 125, 130, 145, 170, 205, 250, 305, 370, 445, 530, 216, 222, 240, 270, 312, 366
OFFSET
0,3
LINKS
N. Bradley Fox et al., Elated Numbers, arXiv:2409.09863 [math.NT], 2024.
FORMULA
a(n) = A000030(n)*A003132(n).
MAPLE
a:= n-> (l-> l[-1]*add(i^2, i=l))(convert(n, base, 10)):
seq(a(n), n=0..65); # Alois P. Heinz, Sep 18 2024
MATHEMATICA
a[n_]:=First[d=IntegerDigits[n]]Norm[d]^2; Array[a, 66, 0] (* Stefano Spezia, Sep 18 2024 *)
PROG
(PARI) a(n) = if (n, my(d=digits(n)); d[1]*norml2(d), 0);
(Python)
def a(n): return (d:=list(map(int, str(n))))[0] * sum(di*di for di in d)
print([a(n) for n in range(66)]) # Michael S. Branicky, Sep 18 2024
CROSSREFS
b-elated function: A000120 (2), A376270 (10).
KEYWORD
nonn,look,base
AUTHOR
Michel Marcus, Sep 18 2024
STATUS
approved
Number of iterations of the "x -> sum of squares of digits of x" map (A003132) for n to converge to either 0, 1 or the 8-cycle (37,58,89,145,42,20,4,16).
+0
1
1, 1, 2, 6, 1, 5, 10, 6, 6, 5, 2, 3, 6, 3, 7, 4, 1, 6, 4, 5, 1, 6, 7, 4, 2, 4, 3, 7, 4, 3, 6, 3, 4, 5, 5, 6, 9, 1, 3, 6, 2, 7, 1, 5, 5, 8, 5, 4, 7, 5, 5, 4, 4, 6, 8, 6, 3, 5, 1, 3, 10, 2, 3, 9, 5, 3, 8, 3, 3, 6, 6, 6, 7, 2, 4, 5, 3, 3, 5, 4, 6, 4, 4, 3, 7, 2
OFFSET
0,3
COMMENTS
The initial number counts as iteration 1.
FORMULA
a(n) <= A193995(n) with equality if and only if n is a Happy number (A007770).
a(n) = 1 if and only if n is in A039943.
a(n) = A099645(n)+1.
PROG
(Python)
def A364682(n):
c = 1
while n not in {0, 1, 37, 58, 89, 145, 42, 20, 4, 16}:
n = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(n))
c += 1
return c
CROSSREFS
KEYWORD
nonn
AUTHOR
Chai Wah Wu, Aug 02 2023
STATUS
approved
The sum of the squares of the digits of n, repeated until reaching a single-digit number.
+0
0
0, 1, 4, 9, 4, 4, 4, 1, 4, 4, 1, 2, 5, 1, 4, 4, 4, 4, 4, 1, 4, 5, 8, 1, 4, 4, 4, 4, 1, 4, 9, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 2, 1, 4, 4, 1, 4, 4, 4, 1, 2, 4, 4, 4, 1, 4, 4, 1, 4, 4, 1, 4, 4, 1
OFFSET
0,3
COMMENTS
Square the digits of n, then sum the squares. Repeat the process until the sum is less than 10.
EXAMPLE
For n=28, the sum of the squares of the digits gives 4+64 = 68. Repeating the process gives 36+64 = 100; repeating once more gives 1+0+0 = 1. Therefore a(28) is 1.
a(n) = 4 for 72 of the first 100 n (0 to 99 inclusive.)
MATHEMATICA
f[n_] := Plus @@ (IntegerDigits[n]^2); a[n_] := NestWhile[f, f[n], # > 9 &]; Array[a, 100, 0] (* Amiram Eldar, Feb 17 2023 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Will Nicholes, Feb 16 2023
STATUS
approved
Sum of squares of digits of primorial base expansion of n.
+0
1
0, 1, 1, 2, 4, 5, 1, 2, 2, 3, 5, 6, 4, 5, 5, 6, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 1, 2, 2, 3, 5, 6, 2, 3, 3, 4, 6, 7, 5, 6, 6, 7, 9, 10, 10, 11, 11, 12, 14, 15, 17, 18, 18, 19, 21, 22, 4, 5, 5, 6, 8, 9, 5, 6, 6, 7, 9, 10, 8, 9, 9, 10, 12, 13, 13, 14, 14, 15, 17, 18, 20, 21, 21, 22
OFFSET
0,4
FORMULA
a(n) = A090885(A276086(n)).
For all n >= 0, a(2n+1) = 1 + a(2n).
EXAMPLE
5 in primorial base (A049345) is written as "21" (because 5 = 2*2 + 1*1), therefore a(5) = 2^2 + 1^2 = 5.
23 in primorial base is written as "321" (because 23 = 3*6 + 2*2 + 1*1), therefore a(23) = 3^2 + 2^2 + 1^2 = 14.
24 in primorial base is written as "400" (because 24 = 4*6 + 0*2 + 0*1), therefore a(24) = 4^2 = 16.
MATHEMATICA
a[n_] := Module[{k = n, p = 2, s = 0, r}, While[{k, r} = QuotientRemainder[k, p]; k != 0 || r != 0, s += r^2; p = NextPrime[p]]; s]; Array[a, 100, 0] (* Amiram Eldar, Mar 06 2024 *)
PROG
(PARI) A360108(n) = { my(s=0, p=2, d); while(n, d = (n%p); s += d^2; n = (n-d)/p; p = nextprime(1+p)); (s); };
CROSSREFS
Cf. A002110 (positions of 1's), A049345, A090885, A276086, A276150.
Cf. also A003132.
KEYWORD
nonn,base,easy,look
AUTHOR
Antti Karttunen, Jan 28 2023
STATUS
approved
Irregular triangle read by rows in which row n lists the possible periods for the iterations of the map sum of n-th powers of digits.
+0
0
1, 1, 8, 1, 2, 3, 1, 2, 7, 1, 2, 4, 6, 10, 12, 22, 28, 1, 2, 3, 4, 10, 30, 1, 2, 3, 6, 12, 14, 21, 27, 30, 56, 92, 1, 25, 154, 1, 2, 3, 4, 8, 10, 19, 24, 28, 30, 80, 93, 1, 6, 7, 17, 81, 123
OFFSET
1,3
LINKS
Eric Weisstein's World of Mathematics, Digitaddition
EXAMPLE
Triangle begins:
1;
1, 8;
1, 2, 3;
1, 2, 7;
1, 2, 4, 6, 10, 12, 22, 28;
1, 2, 3, 4, 10, 30;
1, 2, 3, 6, 12, 14, 21, 27, 30, 56, 92;
1, 25, 154;
1, 2, 3, 4, 8, 10, 19, 24, 28, 30, 80, 93;
1, 6, 7, 17, 81, 123;
...
CROSSREFS
Periods of sum of m-th powers of digits iterated: A031176 (m=2), A031178 (m=3), A031182 (m=4), A031186 (m=5), A031195 (m=6), A031200 (m=7), A031211 (m=8), A031212 (m=9), A031213 (m=10).
Sum of m-th powers of digits: A007953 (m=1), A003132 (m=2), A055012 (m=3), A055013 (m=4), A055014 (m=5), A055015 (m=6), A123253 (m=7), A210840 (m=8).
KEYWORD
nonn,tabf,base,more
AUTHOR
Mohammed Yaseen, Jul 14 2022
STATUS
approved
Numbers m such that A257588(m) = 0.
+0
2
0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 220, 330, 354, 440, 453, 550, 660, 770, 880, 990, 1001, 1100, 1111, 1122, 1133, 1144, 1155, 1166, 1177, 1188, 1199, 1221, 1331, 1441, 1487, 1551, 1575, 1661, 1771, 1784, 1881, 1991, 2002, 2112, 2200, 2211, 2222, 2233, 2244, 2255, 2266, 2277
OFFSET
1,2
COMMENTS
If m is a term, 10*m is also a term; so, terms with no trailing zeros are all primitive terms.
Palindromes with even number of digits (A056524) are all terms.
FORMULA
A257588(a(n)) = 0.
EXAMPLE
354 is a term since 3^2 - 5^2 + 4^2 = 0 (with Pythagorean triple (3,4,5)).
1487 is a term since 1^2 - 4^2 + 8^2 - 7^2 = 0.
MATHEMATICA
f[n_] := Abs @ Total[(d = IntegerDigits[n]^2) * (-1)^Range[Length[d]]]; Select[Range[0, 2300], f[#] == 0 &] (* Amiram Eldar, Mar 20 2022 *)
PROG
(Python)
from itertools import count, islice
def A352535_gen(startvalue=0): # generator of terms >= startvalue
return filter(lambda m: not sum(int(d)**2*(-1 if i % 2 else 1) for i, d in enumerate(str(m))), count(max(startvalue, 0)))
A352535_list = list(islice(A352535_gen(), 30)) # Chai Wah Wu, Mar 24 2022
CROSSREFS
Subsequences: A056524, A333440, A338754.
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Mar 20 2022
STATUS
approved
Happy Niven (or happy harshad) numbers.
+0
1
1, 7, 10, 70, 100, 133, 190, 192, 230, 280, 320, 392, 440, 644, 700, 736, 820, 874, 888, 910, 912, 1000, 1088, 1090, 1092, 1122, 1125, 1128, 1141, 1148, 1152, 1185, 1188, 1212, 1215, 1233, 1251, 1274, 1275, 1300, 1323, 1330, 1332, 1512, 1521, 1547, 1679, 1725
OFFSET
1,2
COMMENTS
Numbers that are divisible by the sum of their digits and whose trajectory under iteration of sum of squares of digits map includes 1.
LINKS
Wikipedia, Happy number
Wikipedia, Harshad number
FORMULA
{ A005349 } intersect { A007770 }.
EXAMPLE
133 is a term because 133/7 = 19 and its trajectory under iteration of sum of squares of digits map is 133 -> 19 -> 82 -> 68 -> 100 -> 1.
MAPLE
q:= proc(n) local m, s; m, s:= n, {};
if irem(n, add(i, i=convert(n, base, 10)))>0 then return false fi;
do if m=1 then return true
elif m in s then return false
else s, m:= s union {m}, add(i^2, i=convert(m, base, 10))
fi
od
end:
select(q, [$1..2000])[];
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alois P. Heinz, Jan 03 2022
STATUS
approved

Search completed in 0.041 seconds