A C submitted a Comment to Problem 42935. Sums of cubes and squares of sums Can someone point me in the right direction?
n = 1e5;
y_correct = uint64(500010000050000);
I get 500010000050005. I do not know how to go beyond double precision.
function y = cubesLessSquare(n)
% Formula
N = (((sum((1:n).^3)*2 - sum(1:n)^2)*2/n))
% double to char
C = sprintf('%f',N)
% char to vector
Y = C - '0'
% take out the dot and the numbers after the dot
Dot = find(Y<0)
Y([Dot:end]) = []
% join the the numbers
Z = sprintf('%d',Y)
% make to double
y = str2num(Z)
end
on 16 Jan 2021 at 19:19 |
A C submitted Solution 4578828 to Problem 1253. Infinite precision division on 11 Jan 2021 at 22:17 |
A C submitted Solution 4572593 to Problem 553. How to multiply? on 11 Jan 2021 at 1:40 |
A C submitted Solution 4572083 to Problem 563. How to add? on 10 Jan 2021 at 21:31 |
A C submitted a Comment to Problem 44309. Pi Digit Probability % I used Machin's Formula: pi = 4[4arctan(1/5) - arctan(1/239)] because it was used for speed. But it will not go no more than 16 digits. How can I go beyond 16 digits?
function [PI] = pidigit(N,n)
A = 0;
F = 10^300;
% Machin's Formula: pi = 4[4arctan(1/5) - arctan(1/239)]
x1 = 1/5;
x2 = 1/239;
for K = 0:1000000000
A1 = 4*((-1)^K*x1^(2*K+1)/(2*K+1));
A2 = (-1)^K*x2^(2*K+1)/(2*K+1);
A = A + 4*(A1 - A2)*F;
end
E = abs(pi*F-A)/(pi*F);
PI = sprintf('%.f',A) -'0';
sum(PI(1:N-1) == n)
sum(PI(1:N-1) == n)/(N-1)
end
on 10 Jan 2021 at 2:32 |
A C submitted Solution 4567918 to Problem 44363. Is this is a Tic Tac Toe X Win? on 9 Jan 2021 at 22:54 |
A C received Community Group Solver badge for Answer is Art! on 8 Jan 2021 at 17:49 |
A C submitted Solution 4562043 to Problem 44652. Draw a 'X'! on 8 Jan 2021 at 17:49 |
A C submitted Solution 4561923 to Problem 44679. Draw 'E' on 8 Jan 2021 at 17:32 |
A C submitted Solution 4561873 to Problem 44686. Draw 'J' on 8 Jan 2021 at 17:27 |
A C submitted Solution 4561808 to Problem 44672. Draw 'C'. on 8 Jan 2021 at 17:19 |
A C submitted Solution 4561743 to Problem 44681. Draw 'H' on 8 Jan 2021 at 17:11 |
A C submitted Solution 4561088 to Problem 44656. Draw a 'N'! on 8 Jan 2021 at 15:41 |
A C submitted Solution 4557978 to Problem 44685. Draw 'B' on 8 Jan 2021 at 4:46 |
A C submitted Solution 4557858 to Problem 1630. ~~~~~~~ WAVE ~~~~~~~~~ on 8 Jan 2021 at 4:06 |
A C submitted Solution 4556353 to Problem 47553. Decipher the number 2 - 3 keys on 7 Jan 2021 at 18:46 |
A C submitted Solution 4555773 to Problem 47548. decipher the number 1 - same key for all digits :) on 7 Jan 2021 at 16:37 |
A C submitted Solution 4551463 to Problem 42737. Spherical Volume on 7 Jan 2021 at 2:25 |
A C submitted Solution 4551458 to Problem 1578. Volume and area of a sphere on 7 Jan 2021 at 2:23 |
A C submitted Solution 4551413 to Problem 2908. Approximation of Pi on 7 Jan 2021 at 2:10 |
A C submitted Solution 4550713 to Problem 44273. Given a square and a circle, please decide whether the square covers more area. on 6 Jan 2021 at 22:05 |
A C submitted Solution 4550643 to Problem 44060. Volume Pillar on 6 Jan 2021 at 21:51 |
A C submitted Solution 4550613 to Problem 2300. Natural numbers in string form on 6 Jan 2021 at 21:28 |
A C received Community Group Solver badge for Basics on Cell Arrays on 6 Jan 2021 at 21:24 |
A C submitted Solution 4550593 to Problem 2300. Natural numbers in string form on 6 Jan 2021 at 21:24 |
A C submitted Solution 4549298 to Problem 1755. Fix the last element of a cell array on 6 Jan 2021 at 17:17 |
A C submitted Solution 4549188 to Problem 43677. String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values on 6 Jan 2021 at 17:01 |
A C submitted Solution 4549183 to Problem 1971. Remove element(s) from cell array on 6 Jan 2021 at 17:00 |
A C submitted Solution 4549143 to Problem 1899. Convert a Cell Array into an Array on 6 Jan 2021 at 16:53 |
A C submitted a Comment to Problem 340. Find last non-zero in a given dimension What is the 3 and 4 dimension in matrix? How is it used?
on 6 Jan 2021 at 14:42 |
A C submitted Solution 4548673 to Problem 340. Find last non-zero in a given dimension on 6 Jan 2021 at 14:36 |
A C submitted Solution 4545858 to Problem 44660. Perimeter of a semicircle on 6 Jan 2021 at 2:25 |
A C submitted Solution 4545813 to Problem 2551. Rounding on 6 Jan 2021 at 2:19 |
A C submitted Solution 4545793 to Problem 380. Convert a numerical matrix into a cell array of strings on 6 Jan 2021 at 2:18 |
A C submitted Solution 4545753 to Problem 380. Convert a numerical matrix into a cell array of strings on 6 Jan 2021 at 2:14 |
A C submitted Solution 4538493 to Problem 676. Reindex a vector on 4 Jan 2021 at 18:04 |
A C submitted Solution 4538123 to Problem 42348. Square a Number on 4 Jan 2021 at 16:52 |
A C submitted Solution 4538113 to Problem 1796. 02 - Vector Variables 5 on 4 Jan 2021 at 16:50 |
A C submitted Solution 4538023 to Problem 44416. Sum of adjacent elements in a vector on 4 Jan 2021 at 16:37 |
A C submitted a Comment to Solution 4532748 when the code is rewritten as y = [y {s(S:Ind(E))}];, it includes the spaces. But, when the code is rewritten y =[y cellstr(s(S:Ind(E)))] it leaves the spaces out. Why does it do that?
on 3 Jan 2021 at 16:26 |
A C submitted Solution 4532748 to Problem 967. Split a string into chunks of specified length on 3 Jan 2021 at 16:15 |
A C submitted Solution 4532723 to Problem 967. Split a string into chunks of specified length on 3 Jan 2021 at 16:08 |
A C submitted Solution 4530838 to Problem 1380. Celsius to Kelvin on 3 Jan 2021 at 4:47 |
A C submitted Solution 4530828 to Problem 84. Longest Divisor Run on 3 Jan 2021 at 4:45 |
A C submitted Solution 4530628 to Problem 90. Connect Four Win Checker on 3 Jan 2021 at 3:22 |
A C submitted Solution 4529723 to Problem 2983. Multiply by 3 on 2 Jan 2021 at 23:44 |
A C submitted Solution 4529708 to Problem 152. Create a cell array out of a struct on 2 Jan 2021 at 23:41 |
A C submitted Solution 4529588 to Problem 642. Convert a vector into a number on 2 Jan 2021 at 22:56 |
A C submitted Solution 4529553 to Problem 381. Angle between two vectors on 2 Jan 2021 at 22:38 |
A C submitted Solution 4527158 to Problem 545. Flip the main diagonal of a matrix on 2 Jan 2021 at 14:47 |