Questions in category: Calculator (Calculator)
软件 >> Calculator

1. 设正整数 $a,b$ 满足 $a^2+b^2=4361$, 求 $a+b$.

Posted by haifeng on 2021-01-17 21:50:13 last update 2021-01-17 21:50:13 | Answers (0) | 收藏


设正整数 $a,b$ 满足 $a^2+b^2=4361$, 求 $a+b$.

2. Factorise()

Posted by haifeng on 2020-12-31 23:01:39 last update 2020-12-31 23:01:39 | Answers (0) | 收藏


>> p(2021)
in> p(2021)
out> 17579

------------------------

>> Factorise(2021)
in> Factorise(2021)
2021 == 43*47
43^1*47^1
out> 2021 == 43*47

------------------------

>> p(43)
in> p(43)
out> 191

------------------------

>> p(47)
in> p(47)
out> 211

------------------------

>> 191*211
in> 191*211

out> 40301

------------------------

>> 40301-17579
in> 40301-17579

out> 22722

------------------------

>> Factorise(22722)
in> Factorise(22722)
22722 == 2*3*7*541
2^1*3^1*7^1*541^1
out> 22722 == 2*3*7*541

------------------------

>> Factorise(237541)
in> Factorise(237541)
237541 == 17*89*157
17^1*89^1*157^1
out> 237541 == 17*89*157

------------------------

>> Factorise(1789157)
in> Factorise(1789157)
1789157 == 73*24509
73^1*24509^1
out> 1789157 == 73*24509

------------------------

>> Factorise(7324509)
in> Factorise(7324509)
7324509 == 3*2441503
3^1*2441503^1
out> 7324509 == 3*2441503

------------------------

>> Factorise(32441503)
in> Factorise(32441503)
32441503 == 101*321203
101^1*321203^1
out> 32441503 == 101*321203

------------------------

>> Factorise(101321203)
in> Factorise(101321203)
101321203 == 103*983701
103^1*983701^1
out> 101321203 == 103*983701

------------------------

>> Factorise(103983701)
in> Factorise(103983701)
103983701 == 8377*12413
8377^1*12413^1
out> 103983701 == 8377*12413

------------------------

>> Factorise(837712413)
in> Factorise(837712413)
837712413 == 3*3*19*19*257837
3^2*19^2*257837^1
out> 837712413 == 3^2*19^2*257837

------------------------

>> Factorise(32192257837)
in> Factorise(32192257837)
32192257837 == 43*167*4482977
43^1*167^1*4482977^1
out> 32192257837 == 43*167*4482977

------------------------

>> Factorise(431674482977)
in> Factorise(431674482977)
431674482977 == 67*6442902731
67^1*6442902731^1
out> 431674482977 == 67*6442902731

------------------------

>> Factorise(676442902731)
in> Factorise(676442902731)
676442902731 == 3*79*2854189463
3^1*79^1*2854189463^1
out> 676442902731 == 3*79*2854189463

------------------------

>> Factorise(3792854189463)
in> Factorise(3792854189463)
3792854189463 == 3*1264284729821
3^1*1264284729821^1
out> 3792854189463 == 3*1264284729821

------------------------

>> Factorise(31264284729821)
in> Factorise(31264284729821)
31264284729821 == 11*13*47*3209*1449589
11^1*13^1*47^1*3209^1*1449589^1
out> 31264284729821 == 11*13*47*3209*1449589

------------------------

>> Factorise(11134732091449589)
in> Factorise(11134732091449589)
11134732091449589 == 7*1901*123829*6757363
7^1*1901^1*123829^1*6757363^1
out> 11134732091449589 == 7*1901*123829*6757363

------------------------

>> Factorise( 7*1901*123829*6757363)
in> Factorise(7*1901*123829*6757363)
hint> 7*1901*123829*6757363 contains non digit char, it is regarded as a string.

------------------------

>> Factorise(719011238296757363)
in> Factorise(719011238296757363)
719011238296757363 == 659*1019*3701*3917*73859
659^1*1019^1*3701^1*3917^1*73859^1
out> 719011238296757363 == 659*1019*3701*3917*73859

------------------------

>> Factorise(65910193701391773859)
in> Factorise(65910193701391773859)
65910193701391773859 == 65910193701391773859
65910193701391773859 == 65910193701391773859^1
out> 65910193701391773859 == 65910193701391773859^1

------------------------

>>

3. 关于 $!n$

Posted by haifeng on 2020-11-15 10:22:50 last update 2020-11-15 10:22:50 | Answers (0) | 收藏


$!n$ 定义为 

\[
!n=1!+2!+3!+\cdots+n!=\sum_{k=1}^{n}k!
\]

 

在 Calculator 中做实验:

 

>> !10
in> !10

out> 4037913

------------------------


>> sum(n!,n,1,10)
in> sum(n!,n,1,10)

out> 4037913

4. Visual Studio 2015的项目当使用Visual Studio 2019打开时碰到问题

Posted by haifeng on 2020-09-24 15:44:11 last update 2020-09-25 11:04:52 | Answers (0) | 收藏


D:\work\cs\c++\vs2019\calculator_vc\calculator\calculator\calculator.vcxproj : warning  : 无法找到 Visual Studio 2010 (v100) 的生成工具。若要使用 Visual Studio 2019 (v142) 生成工具进行生成,请单击“项目”菜单或右键单击解决方案,然后选择“重定向解决方案...”。安装 Visual Studio 2010 (v100) 可使用 Visual Studio 2010 (v100) 生成工具进行生成。

 


 

错误 LNK2019 无法解析的外部符号 _fprintf,函数 _crypt_argchk 中引用了该符号 calculator D:\work\cs\c++\vs2019\calculator_vc\calculator\calculator\tomcrypt.lib(crypt_argchk.obj) 1

 

解决办法:

右键calculator项目, 点击【属性】,在【配置属性】-->【链接器】-->【输入】-->【附加依赖项】中加入 legacy_stdio_definitions.lib


 

1>------ 已启动生成: 项目: calculator, 配置: Debug Win32 ------
1>tomcrypt.lib(md5.obj) : warning LNK4099: 未找到 PDB“vc100.pdb”(使用“tomcrypt.lib(md5.obj)”或在“D:\work\cs\c++\vs2019\calculator_vc\calculator\Debug\vc100.pdb”中寻找);正在链接对象,如同没有调试信息一样
1>tomcrypt.lib(sha1.obj) : warning LNK4099: 未找到 PDB“vc100.pdb”(使用“tomcrypt.lib(sha1.obj)”或在“D:\work\cs\c++\vs2019\calculator_vc\calculator\Debug\vc100.pdb”中寻找);正在链接对象,如同没有调试信息一样
1>tomcrypt.lib(sha256.obj) : warning LNK4099: 未找到 PDB“vc100.pdb”(使用“tomcrypt.lib(sha256.obj)”或在“D:\work\cs\c++\vs2019\calculator_vc\calculator\Debug\vc100.pdb”中寻找);正在链接对象,如同没有调试信息一样
1>tomcrypt.lib(crypt_argchk.obj) : warning LNK4099: 未找到 PDB“vc100.pdb”(使用“tomcrypt.lib(crypt_argchk.obj)”或在“D:\work\cs\c++\vs2019\calculator_vc\calculator\Debug\vc100.pdb”中寻找);正在链接对象,如同没有调试信息一样
1>calculator.vcxproj -> D:\work\cs\c++\vs2019\calculator_vc\calculator\Debug\calculator.exe
1>已完成生成项目“calculator.vcxproj”的操作。

 

参考

https://www.cnblogs.com/wainiwann/p/3446187.html

 


C6262 错误

https://blog.csdn.net/mxclxp/article/details/7991127

 


warning C4273: dll 链接不一致

1>register.cpp
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(26,45): warning C4273: “malloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_malloc.h(97,15): message : 参见“malloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(27,55): warning C4273: “realloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_malloc.h(122,15): message : 参见“realloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(28,55): warning C4273: “calloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_malloc.h(62,15): message : 参见“calloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(29,40): warning C4273: “free”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_malloc.h(85,14): message : 参见“free”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(31,113): warning C4273: “qsort”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_search.h(56,23): message : 参见“qsort”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(35,41): warning C4273: “clock”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\time.h(138,26): message : 参见“clock”的前一个定义

 

在编译libtomcrypt 时, 修改设置

参考

https://blog.csdn.net/bendangth/article/details/47356767?utm_medium=distribute.pc_relevant.none-task-blog-title-1&spm=1001.2101.3001.4242

https://blog.csdn.net/visualcatsharp/article/details/3866349

https://blog.csdn.net/net_wolf_007/article/details/5182376

 

5. Calculator 中的函数

Posted by haifeng on 2020-05-05 10:27:03 last update 2020-05-05 10:27:03 | Answers (0) | 收藏


在 Calculator 中可以使用 listfunctions() 函数列出当前系统中预设的所有函数.

listfunctions() 还可以接受参数 1, 即 listfunctions(1), 它将列出所有函数的原型. 

如果要查看函数的用法, 可以使用 help() 函数, 比如 help(len) 将显示 len() 函数的用法.

 

>> listfunctions()
in> listfunctions()
Collatz
binary2decimal
binary2graycode
binom
cubicsum
cubicsum2
decimal2binary
decimal2fraction
decimal2hex
decimal2octal
eq24
exp
expmo
factorial
factorise
firstfactor
fix_variables
gcd
getValueFromMemAddr
getprecision
graycode2binary
help
iscomposite
isprime
ispseudoprime
lcm
len
listfunctions
listpseudoprimes
ln
log
nextprime
pi
prevprime
print3x1Maps
q_DuanwuPlus
q_duanwu
setprecision
solve
sqrt
sqrtn
sum
symbol
trimzeros
xor


------------------------

>> listfunctions(1)
in> listfunctions(1)
Collatz(num)
binary2decimal(binary)
binary2graycode(binary)
binom(n,k)
cubicsum(max,compareWith)
cubicsum2(min,max,compareWith)
decimal2binary(num)
decimal2fraction(num)
decimal2hex(num)
decimal2octal(num)
eq24(p1,p2,p3,p4)
exp(num)
expmo(base,power,mod)
factorial(positiveinteger)
factorise(positiveInteger)
firstfactor(positiveInteger)
fix_variables(bool)
gcd(num1,num2)
getValueFromMemAddr(memoryAddress)
getprecision(positiveinteger)
graycode2binary(binary)
help(funcName)
iscomposite(positiveinteger)
isprime(positiveinteger)
ispseudoprime(positiveinteger)
lcm(num1,num2)
len(string)
listfunctions(bool)
listpseudoprimes(positiveinteger)
ln(num)
log(num)
nextprime(positiveinteger)
pi()
prevprime(positiveinteger)
print3x1Maps(from,to)
q_DuanwuPlus(positiveinteger)
q_duanwu(positiveinteger)
setprecision(positiveinteger)
solve(equation,x,minValue,maxValue)
sqrt(num)
sqrtn(num,k)
sum(general_term,x,minValue,maxValue)
symbol(x,val)
trimzeros(num)
xor(num1,num2)


Total: 45

------------------------

>>

6. [Calculator]下载

Posted by haifeng on 2019-10-11 11:31:04 last update 2020-12-18 19:48:41 | Answers (0) | 收藏


Calculator 下载地址:

atzjg.net 首页有下载链接.

 

详细链接地址

http://atzjg.net/content/download/software/calculator/calculator.exe

 

 

7. [Calculator] 打印帮助

Posted by haifeng on 2019-10-11 11:03:40 last update 2019-10-11 11:17:28 | Answers (0) | 收藏


Calculator中如果要打印帮助, 可以使用 :h 或 :help 命令

 

>> :h
==================================================
CALCULATOR
==================================================

This calculator supports the following operations:

+, -, *, /, %, ^, mod, !

try:
(5 + 2) * 3 / 7
a=123
b=456
a+b
len(2305843009213693951)
type `:more` (without '`') to show the examples.
`:h` or `:help` to display this hint.
`:thanks` to show the thanks.
`:about` to show the information of this program.
`:version` to print the version of this program.
`:q` or `:quit` or `:exit` to quit this program.


==================================================

 

如果要列出更多功能, 则输入 :more

 

>> :more
==================================================
MATHEMATICAL OPERATIONS
==================================================


Calculator

More Functions

setprecision(12) -- 6 is default precision for division.

Examples:
(5+2)*3/7 -- will calculate the value
-- blank is allowed, try ( 5+ 2) *3 /7
2^1000 -- try it, it is a big number.
isprime(19) -- will return 19 is a prime number.
isprime(2^31-1) -- test whether it is a Mersenne Prime.
iscomposite(20) -- will return 20 is a composite number.
ispseudoprime(341) -- will return 341 is a pseudo prime number.
nextprime(20) -- will return 23.
prevprime(20) -- will return 19.
firstfactor(332797) -- will return 41.
factorise(29399071280019123498) -- 2*3*173*... , try it.
factorial(9) -- means 9!, try input 9!+1
9!6 -- means 9*8*7*6
!9 -- means 1!+2!+3!+...+9!
19 mod 7 -- you can use @ instead of `mod`
if you calculate 2^180000 mod 7, please use expmo(2,180000,7) instead.
sqrt(2) -- the square root of 2, try sqrt(1.21)
sqrtn(a,n) -- the n-th root of number a
binom(5,2) -- the binomial coefficient
gcd(15,12) -- the Greatest Common Divisor
lcm(15,12) -- the Least Common Multiple
xor(10110,1101) -- exclusive or
binary2graycode(10110) -- binary number to gray code
graycode2binary(01001) -- gray code to binary number


binary2decimal(10110) -- binary number to decimal number
decimal2binary(10110) -- decimal number to binary number


decimal2octal(10110) -- decimal number to octal number
decimal2hex(10110) -- decimal number to hexadecimal number


decimal2fraction(1.25) -- decimal number to fraction

exp(x) -- exponential function, try exp(), it is equal to exp(0)

log(x) -- logarithmic function


Compare two numbers:
use <, > or == to compare two numbers.
==================================================
DEFINE VARIABLES DYNAMICALLY
==================================================
Choose which type of variable to define:
type:
a=123
% this will define a variable named a
% try define string or double ...
b="hello world"
pi=3.1415926
-------------------------------------
type `:h` `:help` to display help
`:more` to display hint
`:list` to list all variables defined.
`:clear` to clear all variables.
`:q` or `:quit` or `:exit` to quit.
getValueFromMemAddr(...)


==================================================
APPLICATIONS
==================================================
solve(equation,x,minValue,maxValue), for example:
solve(x^(341-1)mod341==1,x,1,340)
eq24(2,6,12,12) A game to compute 24 by given numbers
Collatz(9) will print the route of 9 to 1
in Collatz conjecture or 3x + 1 conjecture.
==================================================
OTHER FUNCTIONS
==================================================
type `:dev_history` to show the history of
development.
`fix_variables(1)` make variables unchangeable.
`fix_variables(0)` is default setting.
==================================================
>>

 

 

 

 

8. [Calculator]打印历史

Posted by haifeng on 2019-10-11 11:01:07 last update 2019-10-11 11:01:07 | Answers (0) | 收藏


Calculator.exe 中可使用 :dev_history 打印开发的历史

 

>> :dev_history
Version: 0.441
Date: 24/11/2018
exp(x)


Version: 0.442--0.443
Date: 04/01/2019
log(x), ln(x), and fixed some bugs, such as operator==,
Now we can compare .9==0.9 and so on.


Version: 0.444
Date: 04/01/2019
Variables can be defined.
fix_variables(1)
a="1+2/3"
a=2+3*9
:clear


Version: 0.445
Date: 08/03/2019
Add two functions:
binary2decimal()
decimal2binary()


Version: 0.446
Date: 17/03/2019
Add extra file in project, functions.h:
which contains self defined functions.
Fixed function sqrtn()


Version: 0.447
Date: 21/03/2019
:change the function declaration IntDivision(string &, string &) to IntDivision(const string &, const
string &)
And change power operation to fast algorithm.


Version: 0.448
Date: 01/04/2019
:Improved the function plus(), and add char ( in operators[], so can deal with expression a+b*c+(d*e+f
)*g if a,b,...,g are defined.


Version: 0.449
Date: 01/04/2019
:Add function: solve(equation,x,minValue,maxValue).


Version: 0.450
Date: 06/06/2019
exp(x)


fixed bug in computation IntDivision, that is: num1 % num2
add function decimal2octal(n)


add function decimal2hex(n)

add function firstFactor(n)

add function factorise(n)

Version: 0.451
Date: 27/07/2019
fixed bug of internal function ChangeInfix()
add function decimal2fraction(n)


add internal function isInteger(n)

add internal isPositiveInteger(n)

add internal isNegativeInteger(n)

add function !n=1!+2!+...+n!

Version: 0.452
Date: 27/08/2019
add function eq24(a,b,c,d)


Version: 0.453
Date: 06/09/2019
10%+10%
5%%3


Version: 0.454
Date: 19/09/2019
add function Collatz() and print3x1maps(a,b)

Version: 0.455
Date: 21/09/2019
add Lucas-Lehmer test for Mersenne primes in function isprime()
For example: isprime(2^89-1)

Version: 0.456
Date: 11/10/2019
Fixed some BUGs founded on 09-10-2019
For the previous versions, if you input the following :
>> p=3511
>> 2^(p-1)-1mod(p^2)

You will get 2^(3511-1)-1@(3511^2
That is, the last char ) is lost.


-------------------

9. 在Calculator中加入求解一元n次方程的功能

Posted by haifeng on 2019-10-09 09:56:03 last update 2019-10-09 10:09:39 | Answers (0) | 收藏


在Calculator中加入求解一元n次方程的功能, 这里 $n\leqslant 3$.

 

开发日志

 

首先要解决的问题是将输入的不规范方程表达式转换为标准的形式. 比如:

x^2-3x^3+7x-9=0   ===>  -3*x^3+1*x^2+7*x-9==0

系统存入系数向量 w=(-3,1,7,-9), 或者 w=(-9,7,1,-3), 后者方便记忆或转换, 比如 w[i] 即 x^i 的系数

 

 


References:

一元三次方程的求根公式的历史

https://blog.csdn.net/elvis_gao/article/details/1815561