Search: a004207 -id:a004207
|
|
A230107
|
|
Define a sequence by b(1)=n, b(k+1)=b(k)+(sum of digits of b(k)); a(n) is the number of steps needed to reach a term in A004207, or a(n) = -1 if the sequence never joins A004207.
|
|
+20
4
|
|
|
0, 0, -1, 0, 52, -1, 11, 0, -1, 51, 50, -1, 49, 10, -1, 0, 48, -1, 9, 50, -1, 49, 0, -1, 47, 48, -1, 0, 8, -1, 49, 46, -1, 47, 48, -1, 45, 0, -1, 7, 46, -1, 47, 6, -1, 45, 44, -1, 0, 46, -1, 5, 5, -1, 45, 44, -1, 43, 4, -1, 4, 0, -1, 4, 44, -1, 43, 3, -1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
Looking at b(k) mod 9 shows that a(n) = -1 whenever n is a multiple of 3 (since then the b sequence is disjoint from A004207).
Conjecture: the b sequence, for any starting value n, will eventually merge with one of A000004 (the zero sequence), A004207, A016052 or A016096.
|
|
LINKS
|
|
|
EXAMPLE
|
|
|
MAPLE
|
read transforms; # to get digsum
M:=2000;
# f(s) returns the sequence k->k+digsum(k) starting at s
f:=proc(s) global M; option remember; local n, k, s1;
s1:=[s]; k:=s;
for n from 1 to M do k:=k+digsum(k);
s1:=[op(s1), k]; od: end;
# g(s) returns (x, p), where x = first number in common between
# f(1) and f(s), and p is the position where it occurred.
# If f(1), f(s) are disjoint for M terms, returns (-1, -1)
S1:=convert(f(1), set):
g:=proc(s) global f, S1; local t1, p, S2, S3;
S2:=convert(f(s), set);
S3:= S1 intersect S2;
t1:=min(S3);
if (t1 = infinity) then RETURN(-1, -1); else
member(t1, f(s), 'p'); RETURN(t1, p-1); fi;
end;
[seq(g(n)[2], n=1..20)];
|
|
PROG
|
(Haskell)
import Data.Maybe (fromMaybe)
a230107 = fromMaybe (-1) . f (10^5) 1 1 1 where
f k i u j v | k <= 0 = Nothing
| u < v = f (k - 1) (i + 1) (a062028 u) j v
| u > v = f (k - 1) i u (j + 1) (a062028 v)
| otherwise = Just j
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
|
|
1, 2, 4, 8, 16, 32, 55, 83, 121, 170, 232, 302, 379, 470, 571, 674, 781, 896, 1018, 1145, 1282, 1430, 1591, 1760, 1945, 2144, 2362, 2591, 2833, 3083, 3340, 3611, 3892, 4184, 4489, 4802, 5122, 5447, 5782, 6128, 6487, 6863, 7255, 7661, 8077, 8504, 8944, 9392
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Partial sums of a(1) = 1, a(n) = sum of digits of all previous terms. The subsequence of primes in this sequence begins: 2, 83, 379, 571, 2591, 2833, 3083, 6863, 10831. The subsequence of squares in this sequence begins: 1, 4, 16, 121, 4489.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = SUM[i=0..n] A004207(i) = SUM[i=0..n] {b(1) = 1, b(j) = sum of digits of b(j) for j = 0..i} = SUM[i=0..n] {b(1) = 1, b(k) = A007953(b(k)) for k = 0..i}.
|
|
EXAMPLE
|
a(7) = 1 + 1 + 2 + 4 + 8 + 16 + 23 + 28 = 83 is prime.
|
|
MAPLE
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A062028
|
|
a(n) = n + sum of the digits of n.
|
|
+10
76
|
|
|
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 77
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(34) = 34 + 3 + 4 = 41, a(40) = 40 + 4 = 44.
|
|
MAPLE
|
with(numtheory): for n from 1 to 100 do a := convert(n, base, 10):
c := add(a[i], i=1..nops(a)): printf(`%d, `, n+c); od:
|
|
MATHEMATICA
|
Table[n + Total[IntegerDigits[n]], {n, 0, 100}]
|
|
PROG
|
(PARI) SumD(x)={ s=0; while (x>9, s=s+x-10*(x\10); x\=10); s+x }
for(n=0, 1000, write("b062028.txt", n, " ", n + SumD(n))) \\ Harry J. Smith, Jul 30 2009
(Python)
def a(n): return n + sum(map(int, str(n)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A001370
|
|
Sum of digits of 2^n.
(Formerly M1085 N0414)
|
|
+10
42
|
|
|
1, 2, 4, 8, 7, 5, 10, 11, 13, 8, 7, 14, 19, 20, 22, 26, 25, 14, 19, 29, 31, 26, 25, 41, 37, 29, 40, 35, 43, 41, 37, 47, 58, 62, 61, 59, 64, 56, 67, 71, 61, 50, 46, 56, 58, 62, 70, 68, 73, 65, 76, 80, 79, 77, 82, 92, 85, 80, 70, 77
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Same digital roots as A065075 (sum of digits of the sum of the preceding numbers) and A004207 (sum of digits of all previous terms); they enter into the cycle {1 2 4 8 7 5}. - Alexandre Wajnberg, Dec 11 2005
It is believed that a(n) ~ n*9*log_10(2)/2, but this is an open problem. - N. J. A. Sloane, Apr 21 2013
The Radcliffe preprint shows that a(n) > log_4(n). - M. F. Hasler, May 18 2017
|
|
REFERENCES
|
Archimedeans Problems Drive, Eureka, 26 (1963), 12.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
seq(convert(convert(2^n, base, 10), `+`), n=0..1000); # Robert Israel, Mar 29 2015
|
|
MATHEMATICA
|
|
|
PROG
|
(Python) [sum(map(int, str(2**n))) for n in range(56)] # David Radcliffe, Mar 29 2015
(Haskell)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A010062
|
|
a(0)=1; thereafter a(n+1) = a(n) + number of 1's in binary representation of a(n).
|
|
+10
34
|
|
|
1, 2, 3, 5, 7, 10, 12, 14, 17, 19, 22, 25, 28, 31, 36, 38, 41, 44, 47, 52, 55, 60, 64, 65, 67, 70, 73, 76, 79, 84, 87, 92, 96, 98, 101, 105, 109, 114, 118, 123, 129, 131, 134, 137, 140, 143, 148, 151, 156, 160, 162, 165, 169, 173, 178, 182, 187, 193, 196, 199, 204
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
|
|
LINKS
|
Raoul Nakhmanson-Kulish, Graph of f(n), where f(n) = (a(n)-n*log_2(n)/2)/(n*sqrt(log_2(n)*log_2 log_2(n))) (see Stolarsky's estimate below).
|
|
FORMULA
|
a(n) = (n/2)*log n + O(n*sqrt(log n * loglog n)), where log means log_2. In particular, a(n) ~ (n/2)*log n. [Stolarsky]
|
|
EXAMPLE
|
a(7) = 14 because a(6) = 12, which is 1100 in binary (having 2 on bits), and 12 + 2 = 14.
a(8) = 17 because a(7) = 14, which is 1110 in binary (having 3 on bits), and 14 + 3 = 17.
|
|
MATHEMATICA
|
NestList[# + DigitCount[#, 2, 1] &, 1, 60] (* Alonso del Arte, Oct 26 2012 *)
|
|
PROG
|
(Haskell)
a010062 n = a010062_list !! n
(Magma) [n le 1 select 1 else Self(n-1)+&+Intseq(Self(n-1), 2): n in [1..61]]; // Bruno Berselli, Oct 27 2012
(Python)
from itertools import islice
def agen():
an = 1
while True: yield an; an += an.bit_count()
|
|
CROSSREFS
|
For the base-10 analog see A004207.
|
|
KEYWORD
|
nonn,base,easy,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A037123
|
|
a(n) = a(n-1) + sum of digits of n.
|
|
+10
32
|
|
|
0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 46, 48, 51, 55, 60, 66, 73, 81, 90, 100, 102, 105, 109, 114, 120, 127, 135, 144, 154, 165, 168, 172, 177, 183, 190, 198, 207, 217, 228, 240, 244, 249, 255, 262, 270, 279, 289, 300, 312, 325, 330, 336, 343, 351, 360, 370, 381
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Sum of the digital sum of i for i from 0 to n. - N. J. A. Sloane, Nov 13 2013
|
|
REFERENCES
|
N. Agronomof, Sobre una función numérica, Revista Mat. Hispano-Americana 1 (1926), 267-269.
Maurice d'Ocagne, Sur certaines sommations arithmétiques, J. Sciencias Mathematicas e Astronomicas 7 (1886), 117-128.
|
|
LINKS
|
P. J. Grabner, P. Kirschenhofer, H. Prodinger and R. F. Tichy, On the moments of the sum-of-digits function, Applications of Fibonacci numbers, Vol. 5 (St. Andrews, 1992), Kluwer Acad. Publ., Dordrecht, 1993, 263-271.
J.-L. Mauclaire and Leo Murata, On q-additive functions, I. Proc. Japan Acad. Ser. A Math. Sci. 59 (1983), no. 6, 274-276.
J.-L. Mauclaire and Leo Murata, On q-additive functions, II. Proc. Japan Acad. Ser. A Math. Sci. 59 (1983), no. 9, 441-444.
|
|
FORMULA
|
a(n) = Sum_{k=0..n} s(k) = Sum_{k=0..n} A007953(k), where s(k) denote the sum of the digits of k in decimal representation. Asymptotic expression: a(n-1) = Sum_{k=0..n-1} s(k) = 4.5*n*log_10(n) + O(n). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002
a(n) = n*(n+1)/2 - 9*Sum_{k=1..n} Sum_{i=1..ceiling(log_10(k))} floor(k/10^i). - Benoit Cloitre, Aug 28 2003
G.f.: Sum_{k>=1} ((x^k - x^(k+10^k) - 9x^(10^k))/(1-x^(10^k)))/(1-x)^2.
a(n) = (1/2)*((n+1)*(n - 18*Sum_{k>=1} floor(n/10^k)) + 9*Sum_{k>=1} (1 + floor(n/10^k))*floor(n/10^k)*10^k).
a(n) = (1/2)*((n+1)*(2*A007953(n)-n) + 9*Sum_{k>=1} (1+floor(n/10^k))*floor(n/10^k)*10^k). (End)
a(10^k - 1) = 10*a(10^(k - 1) - 1) + 45*10^(k - 1) for k > 0.
a(n) = a(n mod m) + MSD*a(m - 1) + (MSD*(MSD - 1)/2)*m + MSD*((n mod m) + 1), where m = 10^(A055642(n) - 1), MSD = A000030(n). (End)
|
|
MAPLE
|
digsum:=proc(n, B) local a; a := convert(n, base, B):
add(a[i], i=1..nops(a)): end;
f:=proc(n, k, B) global digsum; local i;
add( digsum(i, B)^k, i=0..n); end;
lprint([seq(digsum(n, 10), n=0..100)]); # A007953
lprint([seq(f(n, 1, 10), n=0..100)]); #A037123
lprint([seq(f(n, 2, 10), n=0..100)]); #A074784
lprint([seq(f(n, 3, 10), n=0..100)]); #A231688
lprint([seq(f(n, 4, 10), n=0..100)]); #A231689
|
|
MATHEMATICA
|
a[0] = 0; a[n_] := a[n - 1] + Plus @@ IntegerDigits@ n; Array[a, 70, 0] (* Robert G. Wilson v, Jul 06 2018 *)
|
|
PROG
|
(PARI) a(n)=n*(n+1)/2-9*sum(k=1, n, sum(i=1, ceil(log(k)/log(10)), floor(k/10^i)))
(PARI) a(n)={n++; my(t, i, s); c=n; while(c!=0, i++; c\=10); for(j=1, i, d=(n\10^(i-j))%10; t+=(10^(i-j)*(s*d+binomial(d, 2)+d*9*(i-j)/2)); s+=d); t} \\ David A. Corneth, Aug 16 2013
(Perl) for $i (0..100){ @j = split "", $i; for (@j){ $sum += $_; } print "$sum, "; } __END__ # gamo(AT)telecable.es
(Magma) [ n eq 0 select 0 else &+[&+Intseq(k): k in [0..n]]: n in [0..56] ]; // Bruno Berselli, May 27 2011
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
Vasiliy Danilov (danilovv(AT)usa.net), Jun 15 1998
|
|
EXTENSIONS
|
More terms from Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002
|
|
STATUS
|
approved
|
|
|
|
|
A016052
|
|
a(1) = 3; for n >= 1, a(n+1) = a(n) + sum of its digits.
|
|
+10
25
|
|
|
3, 6, 12, 15, 21, 24, 30, 33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, 147, 159, 174, 186, 201, 204, 210, 213, 219, 231, 237, 249, 264, 276, 291, 303, 309, 321, 327, 339, 354, 366, 381, 393, 408, 420, 426, 438, 453, 465, 480, 492
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Mod 9 this sequence is 3, 6, 3, 6, 3, 6, ... This shows that this sequence is disjoint from A004207. - N. J. A. Sloane, Oct 15 2013
|
|
REFERENCES
|
D. R. Kaprekar, Puzzles of the Self-Numbers. 311 Devlali Camp, Devlali, India, 1959.
D. R. Kaprekar, The Mathematics of the New Self Numbers, Privately printed, 311 Devlali Camp, Devlali, India, 1963.
G. E. Stevens and L. G. Hunsberger, A Result and a Conjecture on Digit Sum Sequences, J. Recreational Math. 27, no. 4 (1995), pp. 285-288.
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
NestList[# + Total[IntegerDigits[#]] &, 3, 51] (* Jayanta Basu, Aug 11 2013 *)
a[1] = 3; a[n_] := a[n] = a[n - 1] + Total@ IntegerDigits@ a[n - 1]; Array[a, 80] (* Robert G. Wilson v, Jun 27 2014 *)
|
|
PROG
|
(Haskell)
a016052 n = a016052_list !! (n-1)
(PARI)
a_list(nn) = { my(f(n, i) = n + vecsum(digits(n)), S=vector(nn+1)); S[1]=3; for(k=2, #S, S[k] = fold(f, S[1..k-1])); S[2..#S] } \\ Satish Bysany, Mar 04 2017
(Python)
from itertools import islice
def A016052_gen(): # generator of terms
yield (a:=3)
while True: yield (a:=a+sum(map(int, str(a))))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A007618
|
|
a(n) = a(n-1) + sum of digits of a(n-1), a(1) = 5.
(Formerly M3792)
|
|
+10
23
|
|
|
5, 10, 11, 13, 17, 25, 32, 37, 47, 58, 71, 79, 95, 109, 119, 130, 134, 142, 149, 163, 173, 184, 197, 214, 221, 226, 236, 247, 260, 268, 284, 298, 317, 328, 341, 349, 365, 379, 398, 418, 431, 439, 455, 469, 488, 508, 521, 529, 545, 559, 578, 598, 620, 628, 644
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
a(2) = 10 and a(590) = 10000 are the first two powers of 10 in this sequence; there are no others below a(19017393928) = 1000000000093. Conjecture: the sequence contains infinitely many powers of 10. - Charles R Greathouse IV, Mar 29 2022
|
|
REFERENCES
|
N. Agronomof, Problem 4421, L'Intermédiaire des mathématiciens, v. 21 (1914), p. 147. (Mentions sequence starting at 11.) - N. J. A. Sloane, Nov 22 2013.
D. R. Kaprekar, Puzzles of the Self-Numbers. 311 Devlali Camp, Devlali, India, 1959.
D. R. Kaprekar, The Mathematics of the New Self Numbers, Privately Printed, 311 Devlali Camp, Devlali, India, 1963.
J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 65.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
PROG
|
(Haskell)
a007618 n = a007618_list !! (n-1)
(Python)
from itertools import accumulate
def f(an, _): return an + sum(int(d) for d in str(an))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A230093
|
|
Number of values of k such that k + (sum of digits of k) is n.
|
|
+10
22
|
|
|
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,102
|
|
COMMENTS
|
a(n) is the number of times n occurs in A062028.
|
|
LINKS
|
|
|
MAPLE
|
with(LinearAlgebra):
read transforms; # to get digsum
for n from 0 to M do
m := n+digsum(n);
od:
t1:=[seq(A062028[i], i=0..M)]; # A062028 as list (but incorrect offset 1)
t2:=[seq(A230093[i], i=0..M)]; # A230093 as list, but then a(0) has index 1
# A003052 := COMPl(t1); # COMPl has issues, may be incorrect for M <> 1000
ctmax:=4;
for h from 0 to ctmax do ct[h] := []; od:
for i from 1 to M do
h := lis2[i];
if h <= ctmax then ct[h] := [op(ct[h]), i]; fi;
od:
|
|
MATHEMATICA
|
Module[{nn=110, a, b, c, d}, a=Tally[Table[x+Total[IntegerDigits[x]], {x, 0, nn}]]; b=a[[All, 1]]; c={#, 0}&/@Complement[Range[nn], b]; d=Sort[Join[a, c]]; d[[All, 2]]] (* Harvey P. Dale, Jun 12 2019 *)
|
|
PROG
|
(Haskell) a230093 n = length $ filter ((== n) . a062028) [n - 9 * a055642 n .. n] -- Reinhard Zumkeller, Oct 11 2013
(PARI) apply( A230093(n)=sum(i=n>0, min(9*logint(n+!n, 10)+8, n\2), sumdigits(n-i)==i), [1..150]) \\ M. F. Hasler, Nov 08 2018
|
|
CROSSREFS
|
Cf. A107740 (this applied to primes).
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A006507
|
|
a(n+1) = a(n) + sum of digits of a(n), with a(1)=7.
(Formerly M4348)
|
|
+10
20
|
|
|
7, 14, 19, 29, 40, 44, 52, 59, 73, 83, 94, 107, 115, 122, 127, 137, 148, 161, 169, 185, 199, 218, 229, 242, 250, 257, 271, 281, 292, 305, 313, 320, 325, 335, 346, 359, 376, 392, 406, 416, 427, 440, 448, 464, 478, 497, 517, 530, 538, 554, 568
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
REFERENCES
|
Editorial Note, Popular Computing (Calabasas, CA), Vol. 4 (No. 37, Apr 1976), p. 12.
GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 36.
D. R. Kaprekar, Puzzles of the Self-Numbers. 311 Devlali Camp, Devlali, India, 1959.
D. R. Kaprekar, The Mathematics of the New Self Numbers, Privately Printed, 311 Devlali Camp, Devlali, India, 1963.
Jeffrey Shallit, personal communication.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
NestList[#+Total[IntegerDigits[#]]&, 7, 50] (* Harvey P. Dale, Jan 25 2021 *)
|
|
PROG
|
(Haskell)
a006507 n = a006507_list !! (n-1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.029 seconds
|