OFFSET
1,2
COMMENTS
The digital sum (base the n-th prime) of n^2.
A lower bound is a(n) >= n^2/prime(n) ~ n/log(n log n). No term less than this can occur after index n, e.g., a(n) > 126 for n > 10^3 and a(n) > 954 for n > 10^4. "Late birds" (such that a(k) > a(n) for all k > n) are a(1) = 1, a(2) = 2, a(4) = 4, a(5) = 5, a(21) = 9, a(27) = 15, a(44) = 16, a(104) = 24, a(173) = 59, a(365) = 61, a(369) = 81, a(500) = 100, a(590) = 124, a(735) = 129, a(840) = 152, a(987) = 169, a(1564) = 196, a(1797) = 249, a(2415) = 305, a(3368) = 400, a(3545) = 425, a(4025) = 475, a(4466) = 520, a(5018) = 556, a(5477) = 565, a(6686) = 676, a(7239) = 771, a(8025) = 795, a(8182) = 904, a(9369) = 939, ... Values that occur not less often than any smaller one are: 1, 2, 4 (once), 5, 9, 15 (twice), 16, 48, 64, 86, 100 (three times), 144 (five times), 169 (seven times), ... Values that never occur are: 3, 6, 7, 8, 11, 13, 14, 18, 19, 20, 21, 22, 23, 25, 26, 29, 30, 32, 34, 35, 38, 39, 40, 43, 44, 45, 47, 51, 53, 54, 56, 58, 62, 67, 68, 69, 70, 71, 72, 74, 75, 77, 78, 80, 82, 83, 87, 89, 90, 91, 92, 94, 97, 98, 99, ... - M. F. Hasler, Nov 25 2016
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..10000
C. Lawson-Perfect and D. Cushing, Integer Sequence Reviews: A075771, A032799, A002717, The Aperiodical, Aug. 6, 2016
FORMULA
a(n) = ds_prime(n)(n^2), where ds_prime(n) = digital sum base the n-th prime.
a(n) = n^2 - (prime(n)-1)*floor(n^2/prime(n)). For example, a(2) = ds_prime(2)(2^2) = ds_3(4) = 1 + 1 = 2; a(6) = ds_prime(6)(6^2) = ds_13(36) = 2 + 10 = 12.
EXAMPLE
6^2/p(6) = 36/13 = 2+10/13; a(6) = 2+10 = 12.
MATHEMATICA
Table[n^2 - (Prime[n] - 1) Floor[n^2 / Prime[n]], {n, 80}] (* Vincenzo Librandi, Feb 18 2015 *)
PROG
(PARI) a(n) = {my(sq = n^2); my(p = prime(n)); (sq % p) + sq\p; } \\ Michel Marcus, Feb 18 2015
(Magma) [n^2-(NthPrime(n)-1)*Floor(n^2/NthPrime(n)): n in [1..70]]; // Vincenzo Librandi, Feb 18 2015
(PARI) A075771(n)=[1, 1]*divrem(n^2, prime(n)) \\ M. F. Hasler, Nov 25 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Werner D. Sand, Oct 09 2002
STATUS
approved