|
|
A052216
|
|
Sums of two powers of 10.
|
|
55
|
|
|
2, 11, 20, 101, 110, 200, 1001, 1010, 1100, 2000, 10001, 10010, 10100, 11000, 20000, 100001, 100010, 100100, 101000, 110000, 200000, 1000001, 1000010, 1000100, 1001000, 1010000, 1100000, 2000000, 10000001, 10000010, 10000100, 10001000, 10010000, 10100000, 11000000, 20000000
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Numbers whose digit sum is 2.
By extension, numbers k such that digitsum(k)^2 - 1 is prime. (PROOF: For any number k whose digit sum d > 2, d^2 - 1 = (d+1)*(d-1) and thus is not prime.) - Christian N. K. Anderson, Apr 22 2024
|
|
LINKS
|
|
|
FORMULA
|
T(n,k) = 10^(n-1) + 10^(k-1) with 1 <= k <= n.
|
|
EXAMPLE
|
The triangular array starts (see formula):
2;
11, 20;
101, 110, 200;
1001, 1010, 1100, 2000;
10001, 10010, 10100, 11000, 20000;
100001, 100010, 100100, 101000, 110000, 200000;
1000001, 1000010, 1000100, 1001000, 1010000, 1100000, 2000000;
...
(End)
|
|
MATHEMATICA
|
t = 10^Range[0, 9]; Select[Union[Flatten[Table[i + j, {i, t}, {j, t}]]], # <= t[[-1]] + 1 &] (* T. D. Noe, Oct 09 2011 *)
With[{nn=7}, Sort[Join[Table[FromDigits[PadRight[{2}, n, 0]], {n, nn}], FromDigits/@Flatten[Table[Table[Insert[PadRight[{1}, n, 0], 1, i]], {n, nn}, {i, 2, n+1}], 1]]]] (* Harvey P. Dale, Nov 15 2011 *)
Select[Range[10^9], Total[IntegerDigits[#]] == 2&] (* Vincenzo Librandi, Mar 07 2013 *)
T[n_, k_]:=10^(n-1)+10^(k-1); Table[T[n, k], {n, 8}, {k, n}]//Flatten (* Stefano Spezia, Nov 03 2023 *)
|
|
PROG
|
(Magma) [n: n in [1..10100000] | &+Intseq(n) eq 2]; // Vincenzo Librandi, Mar 07 2013
(Magma) /* As a triangular array: */ [[10^n+10^m: m in [0..n]]: n in [0..8]]; // Bruno Berselli, Mar 07 2013
(Haskell)
a052216 n = a052216_list !! (n-1)
a052216_list = 2 : f [2] 9 where
f xs@(x:_) z = ys ++ f ys (10 * z) where
ys = (x + z) : map (* 10) xs
(Python)
from itertools import count, islice
def agen(): yield from (10**i + 10**j for i in count(0) for j in range(i+1))
(SageMath)
def A052216(n, k): return 10^(n-1) + 10^(k-1)
flatten([[A052216(n, k) for k in range(1, n+1)] for n in range(1, 13)]) # G. C. Greubel, Feb 22 2024
|
|
CROSSREFS
|
Sums of n powers of 10: A011557 (1), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A052224 (10), A166311 (11), A235151 (12), A143164 (13), A235225(14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20).
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|